Eclipse doesn't initialize JPA persistence

守給你的承諾、 提交于 2019-12-12 01:36:47

问题


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

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 ?

Thanx


回答1:


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.

++



来源:https://stackoverflow.com/questions/34085811/eclipse-doesnt-initialize-jpa-persistence

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!