4

I am using JBoss 6 and am getting a multiple versions error when trying to run my application:

ERROR [STDERR] SLF4J: Class path contains multiple SLF4J bindings.

ERROR [STDERR] SLF4J: Found binding in [vfs:/C:/jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar/org/slf4j/impl/StaticLoggerBinder.class]

ERROR [STDERR] SLF4J: Found binding in [vfs:/C:/jboss-6.0.0.Final/server/default/deploy/newsroom-integration-persistence-service.war/WEB-INF/lib/slf4j-log4j12-1.6.1.jar/org/slf4j/impl/StaticLoggerBinder.class]

My application declares slf4j-log4j12 in the pom but not slf4j-jboss-logmanager so have no idea why its trying to use this. This is the pom:

<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-log4j12</artifactId>
    <version>${org.slf4j-version}</version>
    <scope>runtime</scope>
</dependency>

Any ideas on how to resolve this? It seems to be causing 'DEBUG' level errors to be written to the console even when the level-name set in jboss-logging.xml is set to INFO!!

Community
  • 1
  • 1
maloney
  • 1,633
  • 3
  • 26
  • 49
  • You should try looking at using jboss-deployment-structure.xml to exclude built in module. There was a similar thread in stackoverflow at [configuring logging with jboss](http://stackoverflow.com/questions/18863630/how-to-step-by-step-configure-logging-in-jboss-6-x-with-log4j-in-java/18981756#18981756) – randominstanceOfLivingThing May 01 '14 at 15:28

1 Answers1

2

It doesn't matter what you declare in your pom.xml, JBoss is going to load what's in its common classpath. If you prefer to use the log4j binding, then you have to remove C:/jboss-6.0.0.Final/common/lib/slf4j-jboss-logmanager.jar. This is the approach recommended by Alfresco. Quoting:

You may see the following errors during the startup:

2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: Class path contains multiple SLF4J bindings.

2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: Found binding in [vfszip:/usr/local/jeap51/jboss- as/common/lib/slf4j-jboss-logging.jar/org/slf4j/impl/StaticLoggerBinder.class]

2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: Found binding in [vfszip:/usr/local/jeap51/jboss -as/server/W51J51I1/deploy/alfresco.war/WEB-INF/lib/slf4j-log4j12-1.5.11.jar/org/slf4j/impl/StaticLoggerBinder.class]

2011-10-12 10:47:21,505 ERROR [STDERR] (main) SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

To avoid these errors, remove the /common/lib/slf4j-jboss-logging.jar file.

davidfmatheson
  • 3,539
  • 19
  • 27
  • 1
    Thanks for response @davidfmatheson. I tried removing slf4j-jboss-logmanager.jar from that location but it now gives this error: `DEPLOYMENTS IN ERROR: Deployment "vfs:///C:/jboss-6.0.0.Final/server/default/deploy/quartz-ra.rar" is in error due to the following reason(s): java.lang.ClassNotFoundException: org.slf4j.impl.StaticLoggerBinder from BaseClassLoader@1a78424{vfs:///C:/jboss-6.0.0.Final/server/default/conf/jboss-service.xml}` – maloney May 01 '14 at 14:34
  • This actually solved my sf4j dependency hell on jboss. Thanks! – lotif Jun 09 '15 at 14:59