javaglassfishslf4jglassfish-4jboss-logging

Where to put slf4j jar file in Glassfish 4?


I am trying to use slf4j as the logging provider for jboss-logging which comes bundled with Glassfish 4.1. But no matter where I put the slf4j jar file, jboss-logging is not able to find the jar. It fails during the server start-up with the error below -

Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory not found by org.jboss.logging.jboss-logging [16
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(Unknown Source)

How can I make the slf4j jar visible to the jboss-logging?


Solution

  • You can put your slf4j jar at

    <glassfish installation dir>\glassfish\modules\endorsed\  
    

    You will need to add bridge/implementation as well, otherwise , Glassfish will not be able to find the above mentioned class. You can add slf4j-log4j and log4j or slf4j-jdk jar along with slf4j in endorsed folder mentioned above depending upon what your intentions are.