1

IDEA: 2018.3 Jetty: 9.4.11

I downloaded jrebel folder by following the instructions given in my IDEA

I am getting the following error when running Jetty server in debug mode.

HTTP ERROR 500
Problem accessing /. Reason:

    Server Error
Caused by:
javax.servlet.ServletException: javax.servlet.ServletException: Filtered request failed.
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:146)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.Server.handle(Server.java:531)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:352)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:260)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:281)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
    at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:118)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:762)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:680)
    at java.lang.Thread.run(Thread.java:748)
Caused by: javax.servlet.ServletException: Filtered request failed.
    at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:384)
    at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
    at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1634)
    at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:146)
    at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:524)
    at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:257)
    at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:255)
    at org.eclipse.jetty.server.handler.ContextHandler.__doHandle(ContextHandler.java:1317)
    at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:42020)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:203)
    at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
    at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
    at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:201)
    at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1219)
    at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:144)
    at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
    at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
    ... 10 more
Caused by: java.lang.StackOverflowError
    at org.eclipse.jetty.server.Dispatcher$ForwardAttributes.getAttribute(Dispatcher.java:300)
Sai Nikhil
  • 1,237
  • 2
  • 15
  • 39
  • 1
    Is this the complete stack trace or there is more to it? Perhaps you can see whether there are any recurring elements in the stack trace. – Tiit Jan 04 '19 at 14:15
  • @Tiit There's so much to it. Stackoverflow limits to 30 K characters in the post. I just emailed support@zeroturnaround.com and "Alexander Bolcon" about this issue with an attachment of jrebel.log. Please reply me there if you need any more details. I'll post the final resolution here, once it gets resolved. – Sai Nikhil Jan 04 '19 at 15:19
  • @Tiit: org.eclipse.jetty.server.Dispatcher$ForwardAttributes.getAttribute(Dispatcher.java:300) is the recurring element in the stacktrace. Is it any issue of JRebel with Jetty 9.x? – Sai Nikhil Jan 04 '19 at 21:29

1 Answers1

0

You have a bug in your code that is causing a Forwarding and/or redirect loop.

See

As pointed out in issue #2399 above, you can add a filter that logs your forwarding behaviors to see what's actually going on in your code.

This will help you diagnose where the forwarding loop is coming from.

public static class SimpleFilter implements Filter
{
    @Override
    public void init(FilterConfig filterConfig) throws ServletException { }

    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException
    {
        HttpServletRequest  request;
        HttpServletResponse response;

        if (!(req instanceof HttpServletRequest &&
                res instanceof HttpServletResponse)) {
            throw new ServletException("non-HTTP request or response");
        }

        request = (HttpServletRequest) req;
        response = (HttpServletResponse) res;

        System.out.printf("%s.doFilter() - dispatch:%s uri:%s filterchain:%s%n", this.getClass().getSimpleName(), request.getDispatcherType(), request.getRequestURI(), chain);
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() { }
}
Joakim Erdfelt
  • 46,896
  • 7
  • 86
  • 136
  • Hi. Thanks for your response. I am not facing this issue if I am not using JRebel. Only when I use JRebel I get this issue. Can you please let me know where could be a chance of redirect loop and suggest what is the best way to detect it? – Sai Nikhil Jan 04 '19 at 14:10
  • At this point the only advice I can offer is to not use JRebel if its causing you issues. – Joakim Erdfelt Jan 04 '19 at 14:14
  • 2
    If the problem only happens with JRebel present, then reproduce the issue and afterwards zip and send the `jrebel.log` from your `${USER_HOME}/.jrebel/` directory to support@zeroturnaround.com. Make sure to also include the full stack trace of that StackOverflowError. – Tiit Jan 04 '19 at 14:17