Eclipse不会初始化JPA持久性 [英] Eclipse doesn't initialize JPA persistence
问题描述
当我尝试运行JPA项目时,出现以下错误消息:
when I try to run a JPA project, I get the following error message :
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryProvider.<clinit>(EntityManagerFactoryProvider.java:55)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactoryImpl(PersistenceProvider.java:92)
at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:188)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:79)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:54)
at dao.LayerDAO.<init>(LayerDAO.java:10)
at exec.Run.main(Run.java:9)
Caused by: java.lang.NullPointerException
at org.eclipse.persistence.platform.server.NoServerPlatformDetector.checkPlatform(NoServerPlatformDetector.java:28)
at org.eclipse.persistence.platform.server.ServerPlatformUtils.detectServerPlatform(ServerPlatformUtils.java:58)
at org.eclipse.persistence.internal.jpa.IsolatedHashMap.<clinit>(IsolatedHashMap.java:48)
... 7 more
该项目以前运行过,但是由于问题我需要重新安装Glassfish,现在它已损坏. 我尝试创建一个新项目,但收到了相同的错误消息.
This project was running before, but I needed to reinstall Glassfish because of problems and now it's broken. I tried to create a new project but I got the same error messages.
您有什么想法可以解释这种行为吗?
Do you have an idea of what could explain such a behavior ?
感谢
推荐答案
感谢@Gimby,他让我验证了EclipseLink版本,因此我必须进入项目属性. 在查看BuildPath参数之后,我尝试查看我选择的目标运行时",发现没有选择任何目标. 既然我已经检查过,一切都会变得更好.
Thanx to @Gimby who made me verified my EclipseLink version, I had to go into the project properties. After a look in the BuildPath parameters, I tried to look at the "targeted runtime" I've chosen and found that none was selected. Since I've checked it, everything goes better.
++
这篇关于Eclipse不会初始化JPA持久性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!