GWT java.lang.NoClassDefFoundError:com / google / gwt / util / tools / Utility

时间:2012-11-18 23:40:54

标签: java gwt tomcat

当我将系统部署到Tomcat时,它会显示以下错误信息:

org.apache.catalina.core.ApplicationContext log
SEVERE: Exception while dispatching incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract com.google.gwt.user.client.rpc.XsrfToken com.google.gwt.user.client.rpc.XsrfTokenService.getNewXsrfToken()' threw an unexpected exception: java.lang.NoClassDefFoundError: com/google/gwt/util/tools/Utility
        at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure(RPC.java:385)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:588)
        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:641)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:306)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
        at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:383)
        at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:284)
        at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:322)
        at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:1648)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:636)
Caused by: java.lang.NoClassDefFoundError: com/google/gwt/util/tools/Utility
        at com.google.gwt.user.server.rpc.XsrfTokenServiceServlet.generateTokenValue(XsrfTokenServiceServlet.java:198)
        at com.google.gwt.user.server.rpc.XsrfTokenServiceServlet.getNewXsrfToken(XsrfTokenServiceServlet.java:163)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:616)
        at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:569)
        ... 20 more

这是什么问题?这个应用程序在eclipse中运行良好。 我的谷歌SDK版本是2.5。

3 个答案:

答案 0 :(得分:2)

此类(Utility)未在XsrfTokenServiceServlet中的2.4.02.5.0中使用,仅在2.3.0上,确实是一个错误

您说您正在使用GWT 2.5.0,因此gwt-servlet.jar中的WEB-INF/lib必须是GWT 2.3.0中过时的版本。

答案 1 :(得分:0)

您确定包含com.google.gwt.util.tools.Utility的jar是在项目的WEB-INF / lib上还是在tomcat / lib文件夹中?看起来tomcat无法找到包含该类的jar。

答案 2 :(得分:0)

com / google / gwt / util / tools / Utility类位于gwt-dev.jar中。 但是您不需要将gwt-dev.jar添加到WEB-INF / lib,因为GWT-DEV.jar仅用于开发模式。您不得在服务器端代码上使用此类或从属类。