I was facing the following error when starting my Java EE application in IBM WebSphere Application Server WAS 7.
JPAPUnitInfo E CWWJP0009E: The server cannot create an EntityManagerFactory factory for the NAME_OF_THE_PERSISTENCE_UNIT persistent unit from the org.hibernate.ejb.HibernatePersistence provider in file:/C:/PATH/TO/APPLICATION/target/classes/ module.
There is certainly something broken in the definition of your persistence unit. You may find the configuration in your persistence.xml
file. To get more detailed information you have to enable tracing for the server's JPA support.
Enable tracing in WAS for JPA
From the main menu of the Application Server's Admin Console choose:
com.ibm.ws.jpa.*
Your final trace configuration could look like this:
*=info: com.ibm.ws.jpa.*=all
This may be active immediately or after restart, depending on your choice above.
Now you find the information to be logged in the server's trace.log
file, which is stored in the server's log directory. E.g.
C:\IBM\SDP\runtimes\base_v7\profiles\AppSrv01\logs\server1
Solution
The cause of your problem may vary widely. So you have to rely on the diagnosis of your trace file.
However, in my situation I found the following there:
JPAPUnitInfo 3 Caught unexpected exception:org.hibernate.AnnotationException: Use of @OneToMany or @ManyToMany targeting an unmapped class: com.acme.Class1.prop2[com.acme.Class2]
It could be helpful for you, to look out for an AnnotationException
too. In my case, I added Class2
to the PU definition in my persistence.xml
. That worked.
Good luck folks ;-)