简体   繁体   English

javax.servlet.ServletException: Circular view path [error]: 将再次调度回当前处理程序 URL [/error] - Spring Cloud

[英]javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again - Spring Cloud

I am using the Git based Spring Cloud Project.我正在使用基于 Git 的 Spring Cloud项目。 In this project, I pointed out to the https://github.com/rseroter/pluralsight-spring-cloudconfig-wa-tolls .在这个项目中,我指出了https://github.com/rseroter/pluralsight-spring-cloudconfig-wa-tolls

When I simply launched the URL: http://localhost:8888/actuator/s1rates/default or http://localhost:8888/s1rates/default , got the below error.当我简单地启动 URL 时: http://localhost:8888/actuator/s1rates/defaulthttp://localhost:8888/s1rates/default ,得到以下错误。

Could you please guide why this error is coming ?你能指导为什么会出现这个错误吗?

I already went through below URL's:我已经通过以下网址:

  1. https://github.com/spring-projects/spring-boot/issues/2001 https://github.com/spring-projects/spring-boot/issues/2001
  2. Circular View path error Spring boot 圆形视图路径错误 Spring boot

But it didn't helped me either.但它也没有帮助我。

Error错误

javax.servlet.ServletException: Circular view path [error]: would dispatch back to the current handler URL [/error] again. Check your ViewResolver setup! (Hint: This may be the result of an unspecified view, due to default view name generation.)
    at org.springframework.web.servlet.view.InternalResourceView.prepareForRendering(InternalResourceView.java:209) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:147) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:314) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1325) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1069) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1008) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:925) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:974) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:866) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:635) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:851) ~[spring-webmvc-5.0.8.RELEASE.jar:5.0.8.RELEASE]
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:742) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:728) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:472) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:395) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:316) ~[tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:395) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:254) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:177) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:81) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:800) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:800) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1471) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [na:1.8.0_162]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [na:1.8.0_162]
    at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.32.jar:8.5.32]
    at java.lang.Thread.run(Unknown Source) [na:1.8.0_162]

SpringcloudM2ConfigserverGitApplication.java SpringcloudM2ConfigserverGitApplication.java

@SpringBootApplication
@EnableConfigServer
public class SpringcloudM2ConfigserverGitApplication {

    public static void main(String[] args) {
        SpringApplication.run(SpringcloudM2ConfigserverGitApplication.class, args);
    }
}

application.yml应用程序.yml

server:
  port: 8888
  error:
    whitelabel:
      enabled: false


spring:
  cloud:
    config:
      server:
        git:
          uri: https://github.com/rseroter/pluralsight-spring-cloudconfig-wa-tolls

Error Screen Shot:错误屏幕截图:

在此处输入图片说明

pom.xml pom.xml

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.0.4.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <java.version>1.8</java.version>
        <spring-cloud.version>Finchley.SR1</spring-cloud.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.cloud</groupId>
            <artifactId>spring-cloud-config-server</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-dependencies</artifactId>
                <version>${spring-cloud.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

Had the same exception and couldn't find answer, so here's what I figured out.有同样的例外,找不到答案,所以这就是我想出来的。 When you disable spring.error.whitelabel.enabled , then when there is exception Spring tries to find /error mapping.当您禁用spring.error.whitelabel.enabled ,当出现异常时,Spring 会尝试查找 /error 映射。 When it doesn't find one, uses internal error handler, which resolves to one of error html pages.当它没有找到时,使用内部错误处理程序,它解析为错误 html 页面之一。 When it cannot find those pages, throws exception, and you can guess - tries to find /error mapping.当它找不到那些页面时,抛出异常,你可以猜测 - 尝试找到 /error 映射。 Hence circular error.因此循环错误。 So there are two solutions.所以有两种解决方案。

  1. Add your controller which implements ErrorController with @RequestMapping("/error"), and any logic you need there添加使用@RequestMapping("/error") 实现 ErrorController 的控制器,以及您需要的任何逻辑
  2. Add custom html error pages.添加自定义 html 错误页面。 Eg src/main/resources/static/error/4xx.html and/or src/main/resources/static/error/5xx.html例如src/main/resources/static/error/4xx.html和/或src/main/resources/static/error/5xx.html

Both worked for me.两者都为我工作。

Here is example of first approach https://stackoverflow.com/a/25362790/4252764 .这是第一种方法的示例https://stackoverflow.com/a/25362790/4252764

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 启动应用程序循环视图路径[index]时出现Spring Boot错误:将再次分派回当前处理程序URL [/ index] - Spring boot error when launching Application Circular view path [index]: would dispatch back to the current handler URL [/index] again 带有 ThymeLeaf 错误的 Spring Boot:循环视图路径:将再次分派回当前处理程序 URL。 检查您的 ViewResolver 设置 - Spring Boot with ThymeLeaf error: Circular view path: would dispatch back to the current handler URL again. Check your ViewResolver setup 循环视图路径[home]:将再次分派回当前处理程序URL [/ home] - Circular view path [home]: would dispatch back to the current handler URL [/home] again 循环视图路径 [login]:将再次分派回当前处理程序 URL [/login] - Circular view path [login]: would dispatch back to the current handler URL [/login] again javax.servlet.ServletException:循环视图路径[产品] - javax.servlet.ServletException: Circular view path [products] “圆形视图路径将发送回当前处理程序 URL。” 当使用 Spring 启动和 Thymeleaf - "Circular view path would dispatch back to the current handler URL." when using Spring Boot and Thymeleaf Spring异常处理程序-显示“ 500 javax.servlet.ServletException:Servlet.init()异常”的错误页面 - Spring Exception Handler - show error page for “500 javax.servlet.ServletException: Servlet.init() exception” javax.servlet.ServletException:没有处理程序适配器 - javax.servlet.ServletException: No adapter for handler javax.servlet.ServletException:创建类路径资源中定义的名称为“ userService”的bean时出错 - javax.servlet.ServletException: Error creating bean with name 'userService' defined in class path resource javax.servlet.ServletException: 错误实例化 servlet class org.springframework.web.servlet.DispatcherServlet - javax.servlet.ServletException: Error instantiating servlet class org.springframework.web.servlet.DispatcherServlet
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM