这类似于:https://github.com/spring-projects/spring-boot/issues/694但不一样。我没有使用自定义错误控制器,只是一个带有百里香模板的错误网页。我正在使用Spring Boot 1.1.3.RELEASE和Spring Boot Actuator 1.1.3.RELEASE。
我有一个生成application / octet-stream的方法。当发生错误并且我正在运行嵌入式时,我会收到一个Jetty错误页面。当我在Jetty jetty-9.1.4.v20140401中作为战争部署时,它会进入无限循环。
如果我将产品类型更改为“application / json”,则返回预期的json响应:
{"timestamp":1404326345115,"status":500,"error":"Internal Server Error","exception":"java.io.IOException","message":"Cannot run program \"./makenode.sh\" (in directory \"/opt/myapp/rabbitmq\"): error=2, No such file or directory"}
如果我将它作为application / octet-stream,我会陷入这个循环:
at org.springframework.boot.context.web.ErrorPageFilter.handleErrorStatus(ErrorPageFilter.java:119)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:100)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:85)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1622)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:549)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:586)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:478)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1045)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:261)
at org.eclipse.jetty.server.Dispatcher.forward(Dispatcher.java:101)
at org.springframework.boot.context.web.ErrorPageFilter.handleErrorStatus(ErrorPageFilter.java:119)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:100)
at org.springframework.boot.context.web.ErrorPageFilter.doFilter(ErrorPageFilter.java:85)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1622)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:549)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:586)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1111)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:478)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:183)
如果我运行嵌入式Jetty,则不会发生此循环。