请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

引入缺少的jar包

我的war包解压后,找到lib和本地的对比了一下,发现少了3个jar包,于是手动下载jar包并上传到lib文件,页面还是报500错误

tomcat logs catalina.out报的啥错,看不太明白,求指点

===================================

2020-06-29 16:08:08:876 [http-nio-80-exec-5] %PARSER_ERROR[leval] org.springframework.web.servlet.DispatcherServlet -Initializing Servlet 'spring-dispatcher'

2020-06-29 16:08:09:129 [http-nio-80-exec-5] %PARSER_ERROR[leval] o.s.web.context.support.XmlWebApplicationContext -Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.imooc.o2o.web.shopadmin.ProductCategoryManagementController] from ClassLoader [ParallelWebappClassLoader

  context: o2o

  delegate: false

----------> Parent Classloader:

java.net.URLClassLoader@7ef20235

]

2020-06-29 16:08:09:130 [http-nio-80-exec-5] %PARSER_ERROR[leval] org.springframework.web.servlet.DispatcherServlet -Context initialization failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [com.imooc.o2o.web.shopadmin.ProductCategoryManagementController] from ClassLoader [ParallelWebappClassLoader

  context: o2o

  delegate: false

----------> Parent Classloader:

java.net.URLClassLoader@7ef20235

]

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1778)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:515)

        at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320)

        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)

        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318)

        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199)

        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:845)

        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:877)

        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)

        at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:701)

        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:667)

        at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:715)

        at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:590)

        at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:529)

        at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:169)

        at javax.servlet.GenericServlet.init(GenericServlet.java:158)

        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1144)

        at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1091)

        at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:763)

        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)

        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)

        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:543)

        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)

        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81)

        at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:690)

        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)

        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)

        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:615)

        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:65)

        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:818)

        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1627)

        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)

        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

        at java.lang.Thread.run(Thread.java:748)

Caused by: java.lang.IllegalStateException: Failed to introspect Class [com.imooc.o2o.web.shopadmin.ProductCategoryManagementController] from ClassLoader [ParallelWebappClassLoader

  context: o2o

  delegate: false

----------> Parent Classloader:

java.net.URLClassLoader@7ef20235

]

        at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:507)

        at org.springframework.util.ReflectionUtils.doWithMethods(ReflectionUtils.java:404)

        at org.springframework.core.MethodIntrospector.selectMethods(MethodIntrospector.java:72)

        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.detectHandlerMethods(AbstractHandlerMethodMapping.java:267)

        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.processCandidateBean(AbstractHandlerMethodMapping.java:252)

        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.initHandlerMethods(AbstractHandlerMethodMapping.java:211)

        at org.springframework.web.servlet.handler.AbstractHandlerMethodMapping.afterPropertiesSet(AbstractHandlerMethodMapping.java:199)

        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping.afterPropertiesSet(RequestMappingHandlerMapping.java:164)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1837)

        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1774)

        ... 36 common frames omitted

Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/servlet4preview/http/HttpServletRequest

        at java.lang.Class.getDeclaredMethods0(Native Method)

        at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)

        at java.lang.Class.getDeclaredMethods(Class.java:1975)

        at org.springframework.util.ReflectionUtils.getDeclaredMethods(ReflectionUtils.java:489)

        ... 45 common frames omitted

Caused by: java.lang.ClassNotFoundException: org.apache.catalina.servlet4preview.http.HttpServletRequest

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1358)

        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1180)

        ... 49 common frames omitted


正在回答

3回答

同学好,主要是解决这个问题

Caused by: java.lang.NoClassDefFoundError: org/apache/catalina/servlet4preview/http/HttpServletRequest  

我查网上是说HttpServletRequest类引入的包应该是javax.servlet.http.HttpServletRequest,而不应该是org.apache.catalina.servlet4preview.http.HttpServletRequest,所以看看import的是什么样的package

如果还是没有解决,怀疑是缺少tomcat的某些jar,需要往tomcat的lib添加,本地的tomcat lib里面的jar和线上的比对一下

0 回复 有任何疑惑可以回复我~
提问者 qq_i漫游音乐中倾听你我_0 2020-06-30 15:57:20

https://img1.sycdn.imooc.com//szimg/5efaeee609dfb5ae03340908.jpg

我的war解压后看到的刚好就缺少那三个灰色的jar,所以之前尝试手动添加,重新打war后没有添加,但是报错内容和之前一致,

0 回复 有任何疑惑可以回复我~
翔仔 2020-06-30 00:01:40

同学好,看情况像是jar冲突了,因为相关的jar已经由maven管理并且打包了,所以不用额外新增jar,这个异常是系统发现两个jar有同样的类,所以报错了。建议重新打war上传一次,去掉原先手工添加的jar

0 回复 有任何疑惑可以回复我~
  • 老师好,我重新打war上传一次,看到的报错是一样的,报错原因都没变,这是怎么回事呢?这是不是说我war里面本来就有冲突?
    回复 有任何疑惑可以回复我~ 2020-06-30 15:50:12
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信