[英]How to resolve java.lang.NoClassDefFoundError?
I'm currently working on a simple web project, for which I am using the SDK of Polarion . 我目前正在开发一个简单的Web项目,为此我正在使用Polarion的SDK。 When trying to work with the according *.jar-Files, Tomcat 7 throws the following error message on start-up:
尝试使用相应的* .jar文件时,Tomcat 7在启动时会引发以下错误消息:
SCHWERWIEGEND: Exception sending context initialized event to listener instance of class org.apache.myfaces.webapp.StartupServletContextListener
java.lang.NoClassDefFoundError: Lcom/polarion/alm/ws/client/session/SessionWebService;
According to the research I have undertaken, Java is trying to find an instance of com.polarion.ws.client.session.SessionWebService (thus the leading L ). 根据我进行的研究,Java正在尝试查找com.polarion.ws.client.session.SessionWebService的实例 (因此使用前导L )。 I have checked the classpath for the needed entry - it's there.
我已经检查了所需的条目的类路径-它在那里。
C:\Polarion\polarion\SDK\lib\com.polarion.alm.ws.client\wsclient.jar
As of now, I've run out of ideas what could have gone wrong. 截至目前,我已经没有什么想法可能出了问题。 Do you have any ideas?
你有什么想法?
Thanks a lot! 非常感谢! Simon
西蒙
You are not supposed to put libraries for use in webapps in the CLASSPATH. 您不应在CLASSPATH中将库供Webapp使用。 You are supposed to put them in WEB-INF/lib in your webapp.
您应该将它们放在webapp的WEB-INF / lib中。
Deployment and compilation are different processes. 部署和编译是不同的过程。 You should be aware of that, you can compile but if the necessary libraries are not accessible by the deployed application , you would get this exception.. As previous answer suggests, you should put necessary libraries WEB-INF/lib directory of your web application..
您应该意识到,可以进行编译,但是如果部署的应用程序无法访问必需的库,则会出现此异常。如先前的答案所示,应将Web应用程序的必需库WEB-INF / lib目录放置..
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.