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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4615164/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 07:13:51  来源:igfitidea点击:

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

javatomcatjakarta-ee

提问by NAYAN RAMI

I am putting spring.jar file in my lib folder but still there is error like

我将 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)

and webpage give me error like

和网页给我错误,如

HTTP Status 500 -

HTTP 状态 500 -

How do I resolved it?

我该如何解决?

回答by axtavt

If you want to configure load time weaving on Tomcat, you need to place org.springframework.instrument.tomcat.jarinto libfolder of Tomcat installation directory, as described in the documentation.

如果要在Tomcat上配置load time weaving,需要org.springframework.instrument.tomcat.jar放入Tomcat安装目录的lib文件夹,如文档中所述。

Otherwise, if you don't need it and accidentially used wrong context.xml, you need to remove <Loader>element from it.

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

回答by user2475989

The org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoaderis now located in the spring-instrument-tomcat.jar, which can be downloaded from Maven Central or Spring Source.

org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader现在位于spring-instrument-tomcat.jar,这可以从Maven的中央或春源下载。

回答by Buhake Sindi

Whenever you see an exception with something of this effect (i.e. a ClassNotFoundException):

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

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

You must know that the (from JavaDoc of ClassNotFoundException):

您必须知道(来自 ClassNotFoundException 的 JavaDoc):

no definition for the class with the specified name could be found.

找不到具有指定名称的类的定义。

In this case, com.vaannila.service.UserServiceImplcannot be found (from error log: java.lang.ClassNotFoundException: com.vaannila.service.UserServiceImpl).

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

Make sure you have the jar file included in your project (containing com.vaanila.service.UserServiceImpl).

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