1
votes

I am trying to migrate a aplication running on wildfly 8.2 to jboss 7.2, using slf4j as logging framework. However when I try to deploy in JBoss, I get the following error:

Caused by: java.lang.LinkageError: Failed to link org/jboss/logging/Logger$Level (Module \"deployment.backend-2.1.2.war\" from Service Module Loader): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name \"org/jboss/logging/Logger$Level\""}}}

Current jboss-deployment-structure:

    <exclusions>
        <module name="org.apache.log4j" />
        <module name="org.slf4j" />
        <module name='org.slf4j.impl' />
        <module name="org.apache.commons.logging" />
        <module name="org.log4j" />
        <module name="org.jboss.logging" />
    </exclusions>

I couldn't find any solution to solve this error, running mvn dependency:tree, org.jboss.logging was imported from Hibernate 4.3.11.Final, then my pom with hibernate now looks :

  <dependency>
     <groupId>org.hibernate</groupId>
     <artifactId>hibernate-entitymanager</artifactId>
     <version>${hibernate.version}</version>
     <exclusions>
        <exclusion>
             <groupId>org.jboss.logging</groupId>
             <artifactId>jboss-logging</artifactId>
        </exclusion>
    </exclusions>
  </dependency>

But the same error persists.

1
Is there a reason you're including Hibernate in you deployment?James R. Perkins
Is there a reason you're excluding all the logging modules? My recommendation would be to exclude all logging JARs from your deployment and instead rely on the JBoss logging subsystem.Philippe Marschall

1 Answers

0
votes

This issue is related to the fact that in your configuration file: standalone.xml, you had created or imported the same logger twice, the level also should not repeat.

Caused by: java.lang.LinkageError: Failed to link org/jboss/logging/Logger$Level (Module \"deployment.backend-2.1.2.war\" from Service Module Loader): loader constraint violation: loader (instance of org/jboss/modules/ModuleClassLoader) previously initiated loading for a different type with name \"org/jboss/logging/Logger$Level\""}}}

Furthermore, be careful with the flag use-parent-handlers on the logger configuration, which will dictate if the logger info should be used by the parent handler. More information here