Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLog

 
meenakshi gavhale
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,


while starting the JBoss Server
i get the following error
java.lang.LinkageError: loader constraint violation: when resolving method "org.slf4j.impl.StaticLoggerBinder.getLoggerFactory()Lorg/slf4j/ILoggerFactory;" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, org/slf4j/LoggerFactory, and the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) for resolved class, org/slf4j/impl/StaticLoggerBinder, have different Class objects for the type org/slf4j/ILoggerFactory used in the signature

how to resolve it?

thanks in advanced.
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JBoss has already loaded the Class from a different jar.

I just fought through many of these replace xfire with cxf.

I way I fixed it was to turn verbose on using the jvm -verbose parameter.
Save the output to a text file and find out where the first instance is loaded.
The next one that breaks will tell you which jar to remove.

WP
 
William P O'Sullivan
Ranch Hand
Posts: 859
Chrome IBM DB2 Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In one case:

Caused by: java.lang.ClassNotFoundException: Unexpected error during load of: javax.xml.namespace.QName, msg=loader constraint violation: loader (instance of org/jboss/mx/loading/UnifiedClassLoader3) previously initiated loading for a different type with name "javax/xml/namespace/QName"
at org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:553)
at org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:408)
at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
... 163 more
Caused by: java.lang.LinkageError: loader constraint violation: loader (instance of org/jboss/mx/loading/UnifiedClassLoader3) previously initiated loading for a different type with name "javax/xml/namespace/QName"

So looking at the verbose output, I found:

[Loaded javax.xml.namespace.QName from C:\Program Files\Java\jdk1.6.0_23\jre\lib\rt.jar]

then ...

[Loaded javax.xml.namespace.QName from file:/C:/jboss-eap-4.3/jboss-as-483/server/xxxxxSNAPSHOT.war/WEB-INF/lib/stax-api-1.0.1.jar]
[Loaded java.lang.ClassCircularityError from C:\Program Files\Java\jdk1.6.0_23\jre\lib\rt.jar]
[Loaded javax.xml.namespace.QName from file:/C:/jboss-eap-4.3/jboss-as-483/server/xxxxxSNAPSHOT.war/WEB-INF/lib/stax-api-1.0.1.jar]

So, removing stax-api-1.0.1.jar from our webapp fixed this problem!!

WP
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic