0

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

Lovegiver
  • 413
  • 6
  • 22
  • This is a known issue in eclipse-link 2.6.1 and shouldn't actually affect the application - JPA should still work. The problem likely started to become visible not because you reinstalled Glassfish, but because before you had Glassfish 4.1 and now you have Glassfish 4.1.1 which includes the faulty EclipseLink build. – Gimby Dec 04 '15 at 10:17
  • Relevant: http://stackoverflow.com/questions/32142789/nullpointer-in-log-during-first-connection-to-database and https://bugs.eclipse.org/bugs/show_bug.cgi?id=463629 – Gimby Dec 04 '15 at 10:19
  • Hello @Gimby and thanx for your answer. I've just verified the installed version of EclipseLink in may project : 2.5.2 – Lovegiver Dec 04 '15 at 13:21
  • Okay, but the server has its own version of EclipseLink. That's basically the main point of using a JEE container, so you don't have to deploy things with the application and do compatibility tests with many different vendors of many different APIs. Unless you took specific steps to indicate the version of your application is to be used, I'm pretty sure the version of the server is the active one. – Gimby Dec 04 '15 at 13:29
  • @Gimby OK I understand what you mean, I didn't think to that at all, thanx a lot – Lovegiver Dec 04 '15 at 14:52

1 Answers1

0

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.

++

Lovegiver
  • 413
  • 6
  • 22