I am working on a maven project that uses seam 2.2.0, hibernate 3.5.0-CR-2 as the JPA provider, DB2 as the database server, and Websphere 7 as the application server. Now I am facing the following problem:
- In my EJBs, which are also considered SEAM components, I want to use the EntityManager from the EJB container (@PersistenceContext private EntityManager em), not the Seam EntityManager (@In private EntityManager em). But this is a problem, I cannot get EntityManager using @PersistenceContext.
In server logs, this means that it cannot create an EntityManagerFactory and receives a ClassCastException:
java.lang.ClassCastException: org.hibernate.ejb.HibernatePersistence is incompatible with javax.persistence.spi.PersistenceProvider
After much debugging and searching the forums, I assume that the problem is that Websphere is not using the Hibernate JPA provider.
Has anyone encountered this problem and have a solution? I configured the initial WAS class bootloader for my application to load classes with the application class loader first, and I packed all the necessary jars in the ears of the application, as written in: WAS InfoCenter: EJB 3.0 development features . If necessary, I will publish my persistence.xml, components.xml and stack trace files.
I found this problem discussed here:
Any hint would be helpful.
Thanks in advance! Michaela