App Engine Java错误:java.lang.NoSuchFieldError:CHARSET_UTF8

时间:2013-01-21 22:22:05

标签: java google-app-engine gwt

My App Engine,Java,GWT应用程序仅在生产环境(不在本地)中引发以下错误。

问题似乎既不是由我编写的特定代码(我们回滚代码)引起的,也不是数据存储区(我们尝试使用空代码)。我们替换了一些相关的jar文件(如requestfactory-api.jar)。 这个问题让我感到困惑......

无论如何都要深入挖掘,找到失败点?

javax.servlet.ServletContext log: Exception while dispatching incoming RPC call
java.lang.NoSuchFieldError: CHARSET_UTF8
    at com.google.gwt.user.server.rpc.impl.SerializabilityUtil.generateSerializationSignature(SerializabilityUtil.java:862)
    at com.google.gwt.user.server.rpc.impl.SerializabilityUtil.getSerializationSignature(SerializabilityUtil.java:333)
    at com.google.gwt.user.server.rpc.impl.SerializabilityUtil.encodeSerializedInstanceReference(SerializabilityUtil.java:217)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.getObjectTypeSignature(ServerSerializationStreamWriter.java:651)
    at com.google.gwt.user.client.rpc.impl.AbstractSerializationStreamWriter.writeObject(AbstractSerializationStreamWriter.java:123)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter$ValueWriter$8.write(ServerSerializationStreamWriter.java:153)
    at com.google.gwt.user.server.rpc.impl.ServerSerializationStreamWriter.serializeValue(ServerSerializationStreamWriter.java:585)
    at com.google.gwt.user.server.rpc.RPC.encodeResponse(RPC.java:605)
    at com.google.gwt.user.server.rpc.RPC.encodeResponseForSuccess(RPC.java:471)
    at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:563)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall(RemoteServiceServlet.java:208)
    at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:248)
    at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
    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$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.appengine.tools.appstats.AppstatsFilter.doFilter(AppstatsFilter.java:141)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:102)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.runtime.jetty.SaveSessionFilter.doFilter(SaveSessionFilter.java:35)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter(TransactionCleanupFilter.java:43)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1157)
    at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:388)
    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 com.google.apphosting.runtime.jetty.AppVersionHandlerMap.handle(AppVersionHandlerMap.java:266)
    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.headerComplete(HttpConnection.java:923)
    at com.google.apphosting.runtime.jetty.RpcRequestParser.parseAvailable(RpcRequestParser.java:76)
    at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404)
    at com.google.apphosting.runtime.jetty.JettyServletEngineAdapter.serviceRequest(JettyServletEngineAdapter.java:146)
    at com.google.apphosting.runtime.JavaRuntime$RequestRunnable.run(JavaRuntime.java:447)
    at com.google.tracing.TraceContext$TraceContextRunnable.runInContext(TraceContext.java:454)
    at com.google.tracing.TraceContext$TraceContextRunnable$1.run(TraceContext.java:461)
    at com.google.tracing.TraceContext.runInContext(TraceContext.java:703)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContextNoUnref(TraceContext.java:338)
    at com.google.tracing.TraceContext$AbstractTraceContextCallback.runInInheritedContext(TraceContext.java:330)
    at com.google.tracing.TraceContext$TraceContextRunnable.run(TraceContext.java:458)
    at com.google.apphosting.runtime.ThreadGroupPool$PoolEntry.run(ThreadGroupPool.java:251)
    at java.lang.Thread.run(Thread.java:679)

.classpath文件如下所示:我们首先尝试更新所有依赖项,然后删除特定库以解决错误。

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" path="src"/>
    <classpathentry kind="src" path="test"/>
    <classpathentry kind="src" path=".apt_generated">
        <attributes>
            <attribute name="optional" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
    <classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER/GWT"/>
    <classpathentry kind="con" path="com.google.appengine.eclipse.core.GAE_CONTAINER/App Engine"/>
    <classpathentry kind="con" path="com.google.gdt.eclipse.managedapis.MANAGED_API_CONTAINER/urlshortener-v1r7lv1.12.0-beta"/>
    <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/commons-fileupload-1.2.1.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/objectify-2.2.3.jar" sourcepath="/Users/manuel/Documents/workspace/objectify-2.2.3/src">
        <attributes>
            <attribute name="javadoc_location" value="file:/Users/manuel/Documents/workspace/objectify-2.2.3/javadoc/"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="war/WEB-INF/lib/log4j-1.2.16.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/commons-io-1.4.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/gwt-dnd-3.1.1.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/gwtupload-gae-0.6.4-SNAPSHOT.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/gwtupload-0.6.4-20110712.073705-11.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/gwt-servlet-deps-1.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/gwt-maps-1.1.1.jar"/>
    <classpathentry kind="lib" path="war/WEB-INF/lib/gwt-urlshortener-v1-0.3-alpha.jar"/>
    <classpathentry kind="output" path="war/WEB-INF/classes"/>
</classpath>

1 个答案:

答案 0 :(得分:2)

您使用的是哪个GWT版本?缺少字段错误似乎表明您的部分类是从一个版本的GWT加载的,而部分是来自另一个版本。

快速浏览GWT 2.4.0和2.5.0,指出SerializabilityUtil.generateSerializationSignature(SerializabilityUtil.java:862)仅存在于GWT 2.5.0中,该字段位于com.google.gwt.user中。 server.rpc.RPCServletUtils。相比之下,2.4.0在SerializabilityUtil中没有足够的行,并且有自己的字段来处理编码。如果在类路径中混合使用2.4.0和2.5.0,则可能会导致类似这样的问题。