在Tomcat上运行GWT应用程序时出现以下错误。
在Jetty上运行它时工作正常。
我的代码中没有使用charAt
函数。
如何追踪此错误?
SEVERE: Unexpected error
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.charAt(Unknown Source)
at com.google.gwt.autobean.server.impl.JsonSplittable.create(JsonSplitta
ble.java:35)
at com.google.gwt.autobean.shared.impl.StringQuoter.split(StringQuoter.j
ava:35)
at com.google.gwt.autobean.shared.AutoBeanCodex.decode(AutoBeanCodex.jav
a:520)
at com.google.gwt.requestfactory.server.SimpleRequestProcessor.process(S
impleRequestProcessor.java:121)
at com.google.gwt.requestfactory.server.RequestFactoryServlet.doPost(Req
uestFactoryServlet.java:118)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Authentica
torBase.java:470)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:298)
at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcesso
r.java:864)
at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.pr
ocess(Http11AprProtocol.java:579)
at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:16
65)
at java.lang.Thread.run(Unknown Source)
答案 0 :(得分:1)
此错误表示您的servlet正在接收空请求正文(没有长度,空字符串)。您的Tomcat设置中可能存在错误,它在请求主体到达您的servlet之前将其剥离。这很难说,而且我没有Tomcat。
答案 1 :(得分:0)
清理Tomcat的工作文件夹后,它可以正常工作。