Why does jsp:include (sometimes) cause StackOverflowErrors on Google App Engine?

那年仲夏 提交于 2019-12-01 20:36:07

问题


I am experiencing StackOverflowErrors with all requests to the latest version of an application on GAE. I tracked down Issue #3588 but that was closed because the reporter blamed it on a third-party library and the Google engineer didn't want to look any further. In my case, there is no third-party library to blame. I'm just doing some very basic jsp:includes in my page template.

The logged error starts like this:

java.lang.StackOverflowError
at java.util.HashMap.removeEntryForKey(HashMap.java:565)
at java.util.HashMap.remove(HashMap.java:555)
at org.mortbay.util.AttributesMap.removeAttribute(AttributesMap.java:51)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:441)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.removeAttribute(Dispatcher.java:461)
at org.mortbay.jetty.servlet.Dispatcher$IncludeAttributes.setAttribute(Dispatcher.java:549)
at org.mortbay.jetty.servlet.Dispatcher$IncludeAttributes.removeAttribute(Dispatcher.java:569)
at org.mortbay.jetty.servlet.Dispatcher$IncludeAttributes.setAttribute(Dispatcher.java:549)
at org.mortbay.jetty.servlet.Dispatcher$IncludeAttributes.removeAttribute(Dispatcher.java:569)
at org.mortbay.jetty.servlet.Dispatcher$IncludeAttributes.setAttribute(Dispatcher.java:549)
at org.mortbay.jetty.servlet.Dispatcher$IncludeAttributes.removeAttribute(Dispatcher.java:569)

Get/setAttribute calls repeat for a while, then...

at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:145)
at com.google.apphosting.runtime.jetty.ResourceFileServlet.serveWelcomeFileAsForward(ResourceFileServlet.java:340)
at com.google.apphosting.runtime.jetty.ResourceFileServlet.maybeServeWelcomeFile(ResourceFileServlet.java:281)
at com.google.apphosting.runtime.jetty.ResourceFileServlet.doGet(ResourceFileServlet.java:142)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:418)
at org.mortbay.jetty.servlet.Dispatcher.include(Dispatcher.java:192)
at 

And that block repeats also.

Both the reporter of issue 3588 and I believe this relates to jsp:include somehow. The previous version of my application worked and used jsp:include, but this newer version also uses jsp:param and some EL syntax. Those might be related to the problem, or they might not. This all works in development. The problem only manifests after deploying to GAE, at which point all page requests result in 500 server errors and the logs show this StackOverflowError. None of the logged stack traces mention any of my code anywhere.

The stack trace also mentions maybeServeWelcomeFile and serveWelcomeFileAsForward. Nothing changed in my welcome-file definitions in web.xml with this latest version.

Google Search turned up the issue linked above, but nothing else. My next steps will be trying to isolate the exact change that caused this, but any insight others can provide would be very helpful.


回答1:


This error is caused by jsp:including a file that doesn't exist on the server. See issue #5564. Somehow certain files that exist in my development environment aren't getting uploaded when I deploy to Google App Engine (Update: see also issue #5565).



来源:https://stackoverflow.com/questions/7026447/why-does-jspinclude-sometimes-cause-stackoverflowerrors-on-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!