请问哪里出错了,我要怎么改呀

来源:7-1 SpringBoot配置全局的异常捕获 - web页面跳转

阿钰12346

2019-04-25 08:37

请问哪里出错了,我要怎么改呀,结果跟老师的不一样

https://img1.mukewang.com/5cc1005c00017fd206660132.jpg


https://img.mukewang.com/5cc10085000189ae03310549.jpg

https://img1.mukewang.com/5cc1009c0001e2ce07860451.jpg

https://img4.mukewang.com/5cc101040001bd1013830606.jpg

https://img2.mukewang.com/5cc1011b0001199008500547.jpg


写回答 关注

2回答

  • 阿钰12346
    2019-04-25 08:54:38

    根据之前的问答,我注释之后就能显示这个界面

    https://img3.mukewang.com/5cc104bf000182dc06110256.jpg

    https://img.mukewang.com/5cc104d80001c98505560297.jpg

    没注释的时候控制台报错是这样的:

    java.lang.ArithmeticException: / by zero

    at com.imooc.controller.ErrorController.error(ErrorController.java:16)

    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)

    at java.lang.reflect.Method.invoke(Unknown Source)

    at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)

    at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)

    at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)

    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)

    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)

    at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)

    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)

    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)

    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)

    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:897)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:634)

    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:882)

    at javax.servlet.http.HttpServlet.service(HttpServlet.java:741)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

    at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

    at org.springframework.web.filter.FormContentFilter.doFilterInternal(FormContentFilter.java:92)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

    at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:93)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

    at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:200)

    at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)

    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)

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

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

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

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

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

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

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

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

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

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

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

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

    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)

    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)

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

    at java.lang.Thread.run(Unknown Source)

    2019-04-25 08:53:41.854  WARN 8568 --- [nio-8080-exec-1] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [java.lang.ArithmeticException: / by zero]


  • 阿钰12346
    2019-04-25 08:50:55

    配置是这样的:

    https://img3.mukewang.com/5cc1044c00018eb807150099.jpg

    https://img4.mukewang.com/5cc1045c0001a3d107610414.jpg

SpringBoot开发常用技术整合

SpringBoot 极简开发的框架整合利器

102171 学习 · 508 问题

查看课程

相似问题