java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2657876/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-29 22:15:13  来源:igfitidea点击:

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

javastruts

提问by Sanjeev

I am using My-eclipse and doing a struts project there is no syntax error but on starting tomcat server the following error appear in console.

我正在使用 My-eclipse 并做一个 struts 项目,没有语法错误,但在启动 tomcat 服务器时,控制台中出现以下错误。

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

java.lang.ClassNotFoundException: org.apache.commons.logging.LogFactory

and

javax.servlet.UnavailableException: Parsing error processing resource path jndi:/localhost/strutspro/WEB-INF/struts-config.xml

javax.servlet.UnavailableException: 解析错误处理资源路径 jndi:/localhost/strutspro/WEB-INF/struts-config.xml

any idea whats the problem.

任何想法是什么问题。

回答by Bozho

Donwload commons-loggingand place the jar(s) in WEB-INF/lib.

下载commons-logging并将 jar(s) 放在WEB-INF/lib.

And for the future - google the class name that is not found to see which library it belongs to, download it and put it on the classpath (WEB-INF/libin this case)

对于未来 - 谷歌未找到的类名以查看它属于哪个库,下载并将其放在类路径上(WEB-INF/lib在这种情况下)

回答by James P. Taylor

It looks like you've already found your solution, but my solution to the same problem was a little different.

看起来您已经找到了您的解决方案,但我对同一问题的解决方案略有不同。

Running Tomcat 4.1.29 inside Eclipse 3.6, I started receiving a very similar error (Servlet /webcustom threw load() exception javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/conf/struts-config-resource.xml,...).

在 Eclipse 3.6 中运行 Tomcat 4.1.29,我开始收到一个非常相似的错误(Servlet /webcustom throw load() exception javax.servlet.UnavailableException: Parsing error processing resource path /WEB-INF/conf/struts-config-resource.xml ,...)。

Neither performing an "Eclipse > Project > Clean", nor an "Eclipse > Servers > (Tomcat Server Instance)> Clean Tomcat Work Directory" would resolve the problem for me.

执行“Eclipse > Project > Clean”和“Eclipse > Servers > (Tomcat Server Instance)> Clean Tomcat Work Directory”都不能解决我的问题。

However, after a lot of trial and error, I found the solution to be this...

然而,经过大量的反复试验,我发现解决方案是这样的......

Eclipse > Servers > (Tomcat Server Instance)...

Eclipse > 服务器 > (Tomcat 服务器实例)...

  • Add and Remove > (Remove resource from the Tomcat Server Instance)
  • Clean
  • Add and Remove > (Add resource back to the Tomcat Server Instance)
  • Publish
  • Start
  • 添加和删​​除 > (从 Tomcat 服务器实例中删除资源)
  • 干净的
  • 添加和删​​除 > (将资源添加回 Tomcat 服务器实例)
  • 发布
  • 开始

Hopefully this helps someone else.

希望这对其他人有帮助。

-jpt

-jpt