aspose file tools*
The moose likes JBoss/WildFly and the fly likes Linkage Error with LOG4j Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Linkage Error with LOG4j " Watch "Linkage Error with LOG4j " New topic
Author

Linkage Error with LOG4j

madhup narain
Ranch Hand

Joined: Dec 14, 2004
Posts: 148
I am getting the following error while bringing up the JBOSS server. Can anyone help me locate what the exact issue is

java.lang.LinkageError:
loader constraint violation:
when resolving method "javax.xml.parsers.DocumentBuilder.setErrorHandler(Lorg/xml/sax/ErrorHandler;)V"
the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/apache/log4j/xml/DOMConfigurator,
and the class loader (instance of <bootloader>) for resolved class, javax/xml/parsers/DocumentBuilder,
have different Class objects for the type org/xml/sax/ErrorHandler used in the signature


Money for nothing and Java for Free
SCJP, SCWCD
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

I don't see any issues which would let you think this is a problem with Log4J. But I guess that you have a version clash (means: the same JAR in different versions). Find out which JAR in your deployment contains the class "javax.xml.parsers.DocumentBuilder", check then if you have this JAR in two different versions in your setup (most IDEs provide you a dependency graph if you are using Maven) and throw one version out.
madhup narain
Ranch Hand

Joined: Dec 14, 2004
Posts: 148
my JBoss 5.1 server uses the JRE 6 System library.
After digging through the JAR's i see that the DocumentBuilder is present in rt.jar.

I havent been able to find any JARS in the JBOSS that contain the same DocumentBuilder java file. Do you think i should try plugging out rt.jar from my JRE
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

I would not recommend that no . What version of Java are you using?


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
madhup narain
Ranch Hand

Joined: Dec 14, 2004
Posts: 148
The JRE version that i am using on my JBOSS is :
Java(TM) SE Run-time Environment (build 1.6.0_23-b05)

Can you help find out what JBOSS library may be causing this linkage error ?
I can try to list out the JBOSS JARS that are loaded in the server, would that help ?
Joachim Rohde
Ranch Hand

Joined: Nov 27, 2006
Posts: 423

Martijn Verburg wrote:I would not recommend that no .

Maybe you should also mention, why! ;-)
"rt" stands for runtime and contains the compiled classes of your Java runtime environment. That's why it's not a good idea to delete it.
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Joachim, right you are! Apologies for the short replies at the moment, I'm having to use dictation software while I give my arms a rest for a few weeks.

Madhup, have you deployed any apps? Jboss 5.1 with JDK 1.6.0_23 should run just fine.

I'm also going to move this to the Jboss Forum.
madhup narain
Ranch Hand

Joined: Dec 14, 2004
Posts: 148
Thanks for the reply guys!!!

Ok. here is the thing -
We are migrating one of our JSF applications from RAD-Iplanet-WAS to ECLIPSE-Apache-JBOSS combination.
Since our application was dependent on some of the WAS libraries we had to do some changes to the JAR's.

At present the application compiles and executes allright on the JBOSS server, but we are seeing the error mentioned above.
Hope you get the picture of the migration


Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Chances are that a JAR you have in your app is clashing with the JDK6 version of that class, it's usually a xerces or xalan JAR if I remember correctly. You'll want to make sure that your CLASSPATH isolation is working correctly and/or remove that clashing JAR
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Linkage Error with LOG4j