It’s hard for me when I try to send my own version of Hibernate (and not the one that JBoss provides by default) inside my EAR.
Then I made my deployment "restricted" by including in the EAR a jboss-app.xml file containing the following:
<jboss-app>
<loader-repository>
com.example:archive=unique-archive-name
<loader-repository-config>
java2ParentDelegation=false
</loader-repository-config>
</loader-repository>
</jboss-app>
And, as usual, I declare that my persistent provider in the persistence module is Hibernate, as follows:
<persistence>
<persistence-unit name="myapp">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
...
But then the worst. When deployed, the server throws a ClassCastException when it tries to use the JPA javax.persistence.spi.PersistenceProvider interface (which was implanted with HibernatePersistence) from org.hibernate.ejb.HibernatePersistence .
WEIRD, JPA API EAR, , , EAR JBoss, HibernatePersistence PersistenceProvider, " ".
API JPA, ClassNotFoundException, JBoss JPA.
, ?
JBoss 5.1.0 Hibernate 3.5.6.Final. API JPA - , Hibernate.