简体   繁体   中英

Why am I getting ClassNotFoundException when running/debugging with TomCat through eclipse

I am running Eclipse Java EE IDE for Web Developers. Version: Juno Service Release 1 I have TomCat 7

I have a dynamic web project that has dependencies on other projects.

Previously I was able to start the Tomcat Server through Eclipse and run in Debug mode to step through code as the website was being run locally. Recently I have been getting class not found errors for classes that are in the projects mine is dependant on.

Aug 22, 2013 11:32:33 AM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [default] in context with path [/JaM-Execution]     threw exception [Filter execution threw an exception] with root cause
java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
at com.medplus.data.factory.DAOFactory.<clinit>(DAOFactory.java:38)
at com.medplus.struts2.action.LoginAction.prepare(LoginAction.java:50)

I can build the project into a war and drop it in my local webapps folder and it runs fine. I made sure the other projects were listed as dependencies in my pom.xml file. I have left and come back to this issue, and not been able to resolve it. Any suggestions are appreciated.

Make sure under Java Build Path, on Projects tab you have other dependencies projects and on Libraries tab, all the jars your project uses. Since you are using Maven, check if your Maven bundle (Maven Dependencies) includes all the jars needed for your project.

You can right click on your project, then Maven, then Update Project.

Try by putting slf4j jar in lib folder of your project. Then build the war file again.

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