简体   繁体   中英

Error -java.lang.NoClassDefFoundError: org/apache/commons/logging/LogFactory

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)

我最终将CXF jar更新到最新版本

解决方案:在项目的类路径中执行测试时缺少类解决方案:在pom commons-discovery commons-discovery 0.5测试中添加

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM