logstash/log4j-jsonevent-layout

Tomcat 7.0.50 log4j NoClassDefFoundError org/apache/commons/lang/time/FastDateFormat

callmegar opened this issue · 2 comments

I'm using tomcat 7.0.50 with log4j 1.2.17 with tomcat-juli.jar and tomcat-juli-adapters.jar from the tomcat extras. I get this error every time I start tomcat

log4j:WARN Error during default initialization
java.lang.NoClassDefFoundError: org/apache/commons/lang/time/FastDateFormat
at net.logstash.log4j.JSONEventLayoutV1.(JSONEventLayoutV1.java:38)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:337)
at org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)
at org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:797)
at org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)
at org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)
at org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)
at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)
at org.apache.log4j.LogManager.(LogManager.java:127)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at org.apache.juli.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:262)
at org.apache.juli.logging.impl.Log4JLogger.(Log4JLogger.java:108)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at org.apache.juli.logging.impl.LogFactoryImpl.createLogFromClass(LogFactoryImpl.java:1025)
at org.apache.juli.logging.impl.LogFactoryImpl.discoverLogImplementation(LogFactoryImpl.java:844)
at org.apache.juli.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:541)
at org.apache.juli.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:292)
at org.apache.juli.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:269)
at org.apache.juli.logging.LogFactory.getLog(LogFactory.java:657)
at org.apache.catalina.startup.Catalina.(Catalina.java:926)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
at java.lang.Class.newInstance(Class.java:374)
at org.apache.catalina.startup.Bootstrap.init(Bootstrap.java:239)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:426)
Caused by: java.lang.ClassNotFoundException: org.apache.commons.lang.time.FastDateFormat
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 36 more

tomcat-juli is in the class path, these are the running parameters:

java -Dnop -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -server -Dorg.apache.coyote.USE_CUSTOM_STATUS_MSG_IN_HEADER=false -Dorg.apache.catalina.connector.CoyoteAdapter.ALLOW_BACKSLASH=false -Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true -Dorg.apache.catalina.connector.RECYCLE_FACADES=false -Djava.library.path=/appl/apache-tomcat/shared/lib:/appl/apache-tomcat/common/lib -Xms2G -Xmx2G -XX:MaxPermSize=256m -XX:NewSize=640m -XX:MaxNewSize=640m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/xxx -XX:ParallelGCThreads=2 -XX:-UseConcMarkSweepGC -XX:+UseParNewGC -XX:-PrintGC -XX:-PrintGCDetails -XX:-PrintGCTimeStamps -XX:-TraceClassUnloading -XX:-TraceClassLoading -Dspring.profiles.active=cert -Djava.endorsed.dirs=/../apache-tomcat/endorsed -classpath /.../apache-tomcat/bin/bootstrap.jar:/.../apache-tomcat/bin/tomcat-juli.jar -Dcatalina.base=/.../apache-tomcat -Dcatalina.home=/.../apache-tomcat -Djava.io.tmpdir=/.../apache-tomcat/temp org.apache.catalina.startup.Bootstrap start

Any thoughts?

Using 1.6 version of the layout

I figured out that log4j-jsonevent-layout depends on:
commons-lang-2.4
json-smart-1.1.1,
junit-4.8.1

Added the jar's and is working fine now, couldn't find this in the docs, not sure if it is something I should have known. Not a real java expert.