AppEngine Development Server在JSP中提供StackOverflowError [英] AppEngine Development Server gives StackOverflowError in JSP
问题描述
我正在使用 JSP
文件中的以下代码,该文件是从 AppEngine
serlvet提供的。
I'm using the following code in a JSP
file which I serve from an AppEngine
serlvet.
<script type="text/javascript" >
var role = <%= request.getAttribute("role") %>;
</script>
该变量是从 Servlet
:
req.setAttribute("role", role );
req.getRequestDispatcher("index.jsp").forward(req, resp);
代码在AppEngine生产中运行正常,但在本地开发服务器中,我立即得到以下内容: / p>
The code runs fine on AppEngine production but in the local development server I get the following straight away:
Problem accessing /. Reason:
INTERNAL_SERVER_ERROR
Caused by:
java.lang.StackOverflowError
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
at org.mortbay.jetty.servlet.Dispatcher$ForwardAttributes.setAttribute(Dispatcher.java:438)
这样就像永远。在调试时,我也可以看到Servlet代码被称为无休止的时间。
this goes on like forever. While debugging, I can also see that the Servlet code is called endless times.
我发现几个引用AppEngine生产的类似问题,但发现AppEngine没有可行的修复开发服务器。
I found a few references to a similar problem with AppEngine production but found no workable fix for AppEngine development server.
任何想法?
推荐答案
当使用Google App Engine从servlet转发到JSP时,甚至没有明确设置任何变量也是类似的问题,我所有的都是这样的:
I ran into a similar issue when forwarding to a JSP from a servlet using Google App Engine without even explicitly setting any variables, all I had was the line:
req.getRequestDispatcher("game.jsp").forward(req, resp);
在我的情况下,原来是因为在web.xml中我有以下行(注意catch -all url-pattern:
In my case it turned out to because in web.xml I had the following line (note the catch-all url-pattern:
<servlet-mapping>
<servlet-name>GameServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
我认为这也是捕捉JSP路径,因此循环,当我更改它也不是一个catch-all它的工作原理如下:
I think this was also catching the JSP path and therefore looping. When I change it too not be a catch-all it works. As in:
<servlet-mapping>
<servlet-name>GameServlet</servlet-name>
<url-pattern>/game</url-pattern>
</servlet-mapping>
这篇关于AppEngine Development Server在JSP中提供StackOverflowError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!