0

Web application is deployed, but hits following error message. I am doing with cxf RESTFUL webservice and trying to encode/decode using JSON. I have already added logging library to my WEB-INF but it still shows the following error. I have added Commons Logging 1.1.1 lib in WEB-INF/Lib folder.

java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory
        at org.springframework.web.context.ContextLoader.<init>(ContextLoader.java:143)
        at org.springframework.web.context.ContextLoaderListener.createContextLoader(ContextLoaderListener.java:57)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:48)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4765)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5260)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1525)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1515)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
8
  • What library did you add and where in WEB-INF did you put it? Spring doesn't rely on commons logging (it uses log4j) so something else is looking for it. Commented Jan 4, 2012 at 7:45
  • Did you put it in WEB-INF/lib folder? Commented Jan 4, 2012 at 7:47
  • I have added Commons Logging 1.1.1 lib in WEBINF/Lib folder Commented Jan 4, 2012 at 7:50
  • 3
    If your folder is truly named WEBINF then I think I see your problem... Commented Jan 4, 2012 at 8:02
  • 3
    Also the folder should be named WEB-INF/lib with a lowercase l, not uppercase like in your question. Mentioning this just in case. Commented Jan 4, 2012 at 8:48

3 Answers 3

1

I ended up in updating the CXF jar to the latest version

Sign up to request clarification or add additional context in comments.

Comments

0

The problem is not the class LogFactory itself but something it depends on.

If you have a ClassNotFoundExceptions it means that the class is not found by the classloader, usually meaning that the jar containing this class is missing.

But in your case you have a NoClassDefFoundError, which means that while loading the class above it cannot find a required definition.

1 Comment

So how did you end up fixing this?
0

The classes are missed at the time of execution of test in classpath of the project s Solution : add in your pom commons-discovery commons-discovery 0.5 test

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.