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

筅森魡賤 提交于 2019-12-10 12:19:32

问题


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.

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

any idea whats the problem.


回答1:


Donwload commons-logging and place the jar(s) in 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/lib in this case)




回答2:


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,...).

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

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

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

  • Add and Remove > (Remove resource from the Tomcat Server Instance)
  • Clean
  • Add and Remove > (Add resource back to the Tomcat Server Instance)
  • Publish
  • Start

Hopefully this helps someone else.

-jpt



来源:https://stackoverflow.com/questions/2657876/java-lang-classnotfoundexception-org-apache-commons-logging-logfactory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!