I was facing the following error when starting my EJB application in IBM WebSphere Application Server WAS 7.
JPAPUnitInfo E CWWJP0015E: An error occurred in the org.hibernate.ejb.HibernatePersistence persistence provider when it attempted to create the container entity manager factory for the *YOUR_PERSISTENCE_UNIT* persistence unit. The following error occurred: [PersistenceUnit: *YOUR_PERSISTENCE_UNIT*] class or package not found
While this error message may be unnoticed during startup, at the latest when you try to get your entity manager, you will see this error:
javax.ejb.EJBException: Injection failure; nested exception is: java.lang.IllegalStateException: EntityManagerFactory has not been created for PU : PuId=
The error message is similar for different error scenarios, so you find a lot of solutions in the web, but none of them may fit.
Indeed the hint from the error message class or package not found is correct, although not that helpful since the missing class name is not told.
In my case I had a class listed in my persistence.xml, which didn't exist any longer.
To see, where this error message comes from, have a look at Ejb3Configuration.addNamedAnnotatedClasses(...)
there you will find the following:
throw new PersistenceException( getExceptionHeader() + "class or package not found", cnfe );
So the information which class wasn't found is available in the cnfe ClassNotFoundException
but unfortunately it's not propagated to the log file somehow.
To access the information simply put a debug breakpoint there and inspect the cnfe
object.