我正在Equinox上部署GWT应用程序。它运行,但当我启动一个事件来调用服务器时,我有一个这样的错误:
<title>Error 500 non-HTTP request or response</title>
</head>
<body><h2>HTTP ERROR 500</h2>
<p>Problem accessing /zbapp/zbapp/app. Reason:
<pre> non-HTTP request or response</pre></p><h3>Caused by:</h3><pre>javax.servlet.ServletException: non-HTTP request or response
at javax.servlet.http.HttpServlet.service(HttpServlet.java:715)
at org.eclipse.equinox.http.registry.internal.ServletManager$ServletWrapper.service(ServletManager.java:180)
at org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:126)
at org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:60)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.eclipse.equinox.http.jetty.internal.HttpServerManager$InternalHttpServiceServlet.service(HttpServerManager.java:318)
at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:390)
at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182)
at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:765)
at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:326)
at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542)
at org.mortbay.jetty.HttpConnection$RequestHandler.content(HttpConnection.java:939)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:756)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:218)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)
</pre>
<hr /><i><small>Powered by Jetty://</small></i><br/>
我的web.xml是:
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet-class>main.java.com.gwt.app.server.GreetingServiceImpl</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/zbapp/app</url-pattern>
</servlet-mapping>
我不知道该错误的原因是什么。我在GWT服务的实现中从HttpServlet覆盖了服务方法。
有人可以帮助我吗?
答案 0 :(得分:0)
由于这个原因,它失败了
try {
request = (HttpServletRequest) req;
response = (HttpServletResponse) res;
} catch (ClassCastException e) {
throw new ServletException("non-HTTP request or response");
}
请求/响应 不属于 HttpServletRequest / HttpServletResponse 类型。
在代码中的某处,您尝试使用扩展ServletRequest / ServletResponse 的类来包装 请求/响应。如果应用程序想要 包装请求/响应,则理想情况下,包装类应该扩展HttpServletRequestWrapper / HttpServletResponseWrapper 。