java.lang.NoSuchMethodError 报500

Posted rocky-fang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了java.lang.NoSuchMethodError 报500相关的知识,希望对你有一定的参考价值。

1. 概述

mvc项目 接口报500 localhost 错误日志

07-Jan-2019 17:12:43.664 SEVERE [catalina-exec-21] org.apache.catalina.core.StandardWrapperValve.invoke Servlet.service() for servlet [mvc] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.nestedIfOptional()Lorg/springframework/core/MethodParameter;] with root cause
 java.lang.NoSuchMethodError: org.springframework.core.MethodParameter.nestedIfOptional()Lorg/springframework/core/MethodParameter;
    at org.springframework.web.method.annotation.RequestParamMethodArgumentResolver.supportsParameter(RequestParamMethodArgumentResolver.java:137)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.getArgumentResolver(HandlerMethodArgumentResolverComposite.java:135)
    at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.supportsParameter(HandlerMethodArgumentResolverComposite.java:106)
    at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:156)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest$original$pSbDYkME(InvocableHandlerMethod.java:128)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest$original$pSbDYkME$accessor$WWKseQDM(InvocableHandlerMethod.java)
    at org.springframework.web.method.support.InvocableHandlerMethod$auxiliary$Zy6Vi8vw.call(Unknown Source)
    at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:93)
    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java)
    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:814)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:737)
    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:969)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:871)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:845)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
    at org.apache.catalina.core.StandardHostValve.invoke$original$umjsuVOU(StandardHostValve.java:141)
    at org.apache.catalina.core.StandardHostValve.invoke$original$umjsuVOU$accessor$UtkajdYr(StandardHostValve.java)
    at org.apache.catalina.core.StandardHostValve$auxiliary$qySWmFHL.call(Unknown Source)
    at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:93)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
    at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
    at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2458)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
    at java.lang.Thread.run(Thread.java:745)

2. 分析

百度看到有说jar冲突的 受启发

查看pom文件 引入了两个公司的jar 

        <dependency>
                <groupId>xx</groupId>
                <artifactId>xx-util</artifactId>
                <version>${xx.version}</version>
            </dependency>
            <dependency>
                <groupId>xx-arch</groupId>
                <artifactId>xx-okHttp</artifactId>
                <version>${xx.version}</version>
            </dependency>

进入 上面那个jar A的pom 文件 发现 已经对下面那个jar B 进行了封装 重复了

3. 解决方案

去掉上面那个jar A,   reboot  ok了

 





























































以上是关于java.lang.NoSuchMethodError 报500的主要内容,如果未能解决你的问题,请参考以下文章