Update Hibernate on JBOSS

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.

+5
3

. JBoss 5.x:

JBoss//[]/ /--jboss- beans.xml

:

   <bean name="EARClassLoaderDeployer" class="org.jboss.deployment.EarClassLoaderDeployer">
      <property name="isolated">false</property>
   </bean>

true.

+2

hibernate-entitymanager.jar?

​​ /lib 3.5.6.

+1

jboss, jboss-classloading.xml WEB-INF -. .

<classloading xmlns="urn:jboss:classloading:1.0"
domain="pentaho.ear"
export-all="NON_EMPTY"
import-all="true"
parent-first="false">
</classloading>
+1

All Articles