java.lang.ClassNotFoundException:org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader

时间:2011-01-06 13:03:04

标签: java tomcat java-ee

我将spring.jar文件放在我的lib文件夹中但仍有错误,如

 at org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)
 at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:52)
 at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:159)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
 at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
 at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:261)
 at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
 at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:581)
 at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
 at java.lang.Thread.run(Unknown Source)

和网页给我错误,如

  

HTTP状态500 -

我该如何解决?

3 个答案:

答案 0 :(得分:17)

如果要在Tomcat上配置加载时编织,则需要将org.springframework.instrument.tomcat.jar放入lib文件夹的Tomcat安装目录,如{{3}中所述}。

否则,如果您不需要它并且意外使用了错误的context.xml,则需要从中移除<Loader>元素。

答案 1 :(得分:2)

org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader现在位于spring-instrument-tomcat.jar,可以从Maven Central或Spring Source下载。

答案 2 :(得分:0)

每当您看到具有此效果的异常时(即ClassNotFoundException):

java.lang.ClassNotFoundException: xx.xxx.class.ClassName

你必须知道(来自ClassDotFoundException的JavaDoc):

  

没有关于类的定义   可以找到指定的名称。

在这种情况下,无法找到com.vaannila.service.UserServiceImpl(来自错误日志:java.lang.ClassNotFoundException: com.vaannila.service.UserServiceImpl)。

确保项目中包含jar文件(包含com.vaanila.service.UserServiceImpl)。