[jboss-user] [EJB 3.0] - Isolated Classloader with JPA (java.lang.ClassCastException:

FelderR do-not-reply at jboss.com
Fri Jun 15 06:59:40 EDT 2007


Each EAR Deployment is isolated in a seperate Classloader. This is due to the fact, that we use different Hibernate versions on different EAR Deployments. 

We specifiy the isolation in the jboss-app.xml file as following:
<jboss-app>
  <loader-repository>classloader:loader=earfilename
    <loader-repository-config>java2ParentDelegation=false
    </loader-repository-config> 
  </loader-repository>
</jboss-app>

While migrating from native Hibernate access to JPA access we consider problems with this isolated classloaders, as the EntityManagerFactory is built from the Class org.jboss.ejb3.entity.PersistenceUnitDeployment. This class is in the Library jboss-ejb3.jar which is located in the lib directory of JBoss. 

The problem is, that we fall back to the lib directory of JBoss and therefore the Hibernate Version that lies within this directory is used as persistence provider for JPA. 

So we have two different versions of hibernate, one in the lib directory and one in the EAR file. This leads to the problem that we get a ClassCastException when setting the Dialect as the Dialect Object was used from the hibernate Version within the EAR file, the DialectFactory was used from the hibernate version within the lib directory.

Any ideas (especially to the JBoss Members) how to solve this issue?

Thx Rene

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4054696#4054696

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4054696



More information about the jboss-user mailing list