[slf4j-user] SLF4j and Log4j on WebSphere 8.5 - What is correct configuration?

tekman tekvisle at hotmail.com
Mon Jul 7 10:54:40 CEST 2014


What's the correct way to configure slf4j + log4j on WebSphere 8.5. My
approach was: 
* Include slf4j-api in WEB-INF\lib of the war files of the applications 
* Include the binding ja slf4j-log4j in WebSphere lib 
* Include log4j.xml in JVM classpath external to the war file.

Only problem is that it doesn't work. It fails with an error on
initializing. Guess my approach is wrong?

Thanks for any assistance!

Here's the stack trace. Note that slfj-api is found in WEB-INF\lib of the
WAR file:
Caused by: java.lang.NoClassDefFoundError: org.slf4j.spi.LoggerFactoryBinder
	at java.lang.ClassLoader.defineClassImpl(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:295)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:154)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:711)
	at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
	at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:1159)
	at java.security.AccessController.doPrivileged(AccessController.java:314)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:594)
	at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
	at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:116)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
	at
com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
	at
com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
	at
com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:616)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
	at
com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
	at
com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:584)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
	at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
	at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
	at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
	at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
	at
no.klp.minside.handler.SoapLoggingHandler.<clinit>(SoapLoggingHandler.java:28)
	at java.lang.J9VMInternals.initializeImpl(Native Method)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:236)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:539)
	at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
	at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:110)
	at
org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
	... 113 more
Caused by: java.lang.ClassNotFoundException:
org.slf4j.spi.LoggerFactoryBinder
	at java.net.URLClassLoader.findClass(URLClassLoader.java:599)
	at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)
	at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:116)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:690)
	... 147 more



--
View this message in context: http://slf4j.42922.n3.nabble.com/SLF4j-and-Log4j-on-WebSphere-8-5-What-is-correct-configuration-tp4025748.html
Sent from the slf4j - user mailing list archive at Nabble.com.


More information about the slf4j-user mailing list