@Controller没有注意报错,Ljavax/servlet/http/HttpServletMapping

调用接口报错,@Controller层用着个注解返回时报错,这个注释可以返回页面,特别是前后端没有分类时用的多
1,在方法前添加@ResponseBody注解,返回是JSON,XML
2,修改为@RestController,这块注释只会返回JSON,XML(自定义返回格式)


Caused by: java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;
    at org.apache.catalina.core.ApplicationHttpRequest.setRequest(ApplicationHttpRequest.java:690)
    at org.apache.catalina.core.ApplicationHttpRequest.(ApplicationHttpRequest.java:114)
    at org.apache.catalina.core.ApplicationDispatcher.wrapRequest(ApplicationDispatcher.java:917)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:358)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:170)
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:316)
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1370)
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1116)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1055)
    ... 58 common frames omitted

2019-04-18 16:30:31.618 ERROR [ace-admin,,,] 13196 --- [nio-8762-exec-3] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Handler processing failed; nested exception is java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;] with root cause

java.lang.NoSuchMethodError: javax.servlet.http.HttpServletRequest.getHttpServletMapping()Ljavax/servlet/http/HttpServletMapping;

@Controller没有注意报错,Ljavax/servlet/http/HttpServletMapping_第1张图片@Controller没有注意报错,Ljavax/servlet/http/HttpServletMapping_第2张图片

你可能感兴趣的:(Servlet)