简体   繁体   English

为什么在通过eclipse运行/调试TomCat时会收到ClassNotFoundException

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

I am running Eclipse Java EE IDE for Web Developers. 我正在为Web开发人员运行Eclipse Java EE IDE。 Version: Juno Service Release 1 I have TomCat 7 版本:Juno Service Release 1我有TomCat 7

I have a dynamic web project that has dependencies on other projects. 我有一个动态的Web项目,它依赖于其他项目。

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. 以前我能够通过Eclipse启动Tomcat服务器并在调试模式下运行,以便在本地运行网站时逐步执行代码。 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. 我可以将项目构建为战争并将其放在我的本地webapps文件夹中,它运行正常。 I made sure the other projects were listed as dependencies in my pom.xml file. 我确保其他项目在我的pom.xml文件中列为依赖项。 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. 确保在Java Build Path下,在Projects选项卡上有其他依赖项目,在Libraries选项卡上,确保项目使用的所有jar。 Since you are using Maven, check if your Maven bundle (Maven Dependencies) includes all the jars needed for your project. 由于您使用的是Maven,请检查您的Maven软件包(Maven依赖项)是否包含项目所需的所有jar文件。

You can right click on your project, then Maven, then Update Project. 您可以右键单击您的项目,然后单击Maven,再单击Update Project。

Try by putting slf4j jar in lib folder of your project. 尝试将slf4j jar放在项目的lib文件夹中。 Then build the war file again. 然后再次构建war文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 为什么在Java应用程序中收到ClassNotFoundException? - Why am I getting a ClassNotFoundException in a java application? 为什么我收到NoClassDefFoundError / ClassNotFoundException - Why am I getting NoClassDefFoundError / ClassNotFoundException 从eclipse运行Google App时,为什么会出现以下错误? - Why am I getting the following error when running Google App from eclipse? 在Tomcat上通过Eclipse运行项目时出现404 - 404 when running project through eclipse on Tomcat 无法通过Eclipse进行Tomcat调试 - Tomcat debugging not possible through eclipse 负载:找不到类MyApplet:java.lang.ClassNotFoundException。 包中有类文件时,为什么会得到这个? - load: class MyApplet not found : java.lang.ClassNotFoundException. Why am i getting this,when the class file is there in the package? 当我在eclipse上借助appium运行程序时,出现会话未创建错误 - When I am running program with the help of appium on eclipse i am getting session not created error 当我从 Spring Boot Jar 运行但不是通过 Eclipse 时出现 ClassNotFoundException - ClassNotFoundException when I run from a Spring Boot Jar, but not through Eclipse 为什么会出现错误“ java.lang.ClassNotFoundException”? - Why am I getting an error “java.lang.ClassNotFoundException”? 为什么我收到java.lang.ClassNotFoundException? - Why am I getting a java.lang.ClassNotFoundException?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM