0

We use Jboss 5.1 in which we deploy several of our applications. Now, Jboss has a version of hibernate jars in its common/libs. One of our application uses a newer version of hibernate jars. So, we had the dependency jars packaged in the war that gets deployed in Jboss. The application gets deployed fine, but when we try hitting in, it throws the below exception.

My suspicision is that Jboss is using its own version of hibernate jars, but not the ones packaged in the war....How do i make Jboss uses the hibernate jars that come from the war but not from its common/lib

I prefer to make a change in the concerened application, but not in Jboss as there are several other application which live in the same Jboss instance and I do not want to mess them up by modifiying jars in jboss/common/lib

SEVERE [ContainerResponse] The exception contained within MappableContainerException could not be mapped to a response, re-throwing to the HTTP container
java.lang.NoSuchFieldError: INSTANCE
    at org.hibernate.type.StandardBasicTypes.<clinit>(StandardBasicTypes.java:45)
user1717230
  • 443
  • 1
  • 15
  • 30

2 Answers2

0

Java EE class loaders are a hierarchy:

  1. Bootstrap
  2. App server
  3. Application

Since the app server class loader finds its version of the Hibernate JARs first, your app is out of luck.

You have to tell JBOSS to prefer application class loader JARs. Google for the config to do so; I don't remember it.

duffymo
  • 305,152
  • 44
  • 369
  • 561
0

check this link out.. http://huima.wordpress.com/2011/09/16/having-fun-with-jboss-classloader-or-how-i-figured-out-how-to-get-my-application-to-work-in-jboss-5/

there are other links inside the article that explains JBoss class loading in detail, which you could check out as well. The way I have done it before is by adding jboss-classloading.xml inside WEB-INF of the war with the below contents

<classloading xmlns="urn:jboss:classloading:1.0"
name="yourapp.war"
domain="IsolatedDomain"
import-all="false"
parent-first="false" >
</classloading>
ranjithkr
  • 594
  • 3
  • 10