NoClassDefFoundError:运行 GWT 时的 GuiceServletContextListener +来自 Eclipse 的 GAE
当尝试从 Eclipse 将我的项目作为 WebApplication 运行时,出现以下错误:
[WARN] failed com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@4b903fd{/,D:\Dev\Projects\The Five Orbs\trunk\target\fiveorbs-0.1}: java.lang.NoClassDefFoundError: com/google/inject/servlet/GuiceServletContextListener
[WARN] failed JettyContainerService$ApiProxyHandler@eb4d977: java.lang.NoClassDefFoundError: com/google/inject/servlet/GuiceServletContextListener
[WARN] Error starting handlers
java.lang.NoClassDefFoundError: com/google/inject/servlet/GuiceServletContextListener
尽管可以在编译时找到该类(我的自定义 GuiceServletConfig 扩展了 GuiceServletContextListener 并正确编译)。
guice-servlet-3.0.jar
库同时出现在项目构建路径和 Eclipse 中 Web 应用程序运行配置的类路径中。
我的运行配置的参数面板具有以下配置: 在程序参数中:
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl TheFiveOrbs.jsp -logLevel INFO -server com.google.appengine.tools.development.gwt.AppEngineLauncher -port 8888 -codeServerPort 9997 -war "D:\Dev\Projects\The Five Orbs\trunk\target\fiveorbs-0.1" com.fiveorbs.TheFiveOrbs
在虚拟机参数中:
-javaagent:D:\Dev\Programs\appengine-java-sdk\lib\agent\appengine-agent.jar -Xmx512m -Dappengine.sdk.root=D:\Dev\Programs\appengine-java-sdk
当我使用 Maven 从命令提示符运行 mvn gae:run 时,一切都很好 - 服务器正常启动并且没有显示任何异常。
我已经在这个问题上苦苦挣扎了几个小时,真的无法理解为什么会发生。
预先感谢您提供的任何提示。
塞巴斯蒂安
When trying to run my project as a WebApplication from Eclipse, I have the following error:
[WARN] failed com.google.apphosting.utils.jetty.DevAppEngineWebAppContext@4b903fd{/,D:\Dev\Projects\The Five Orbs\trunk\target\fiveorbs-0.1}: java.lang.NoClassDefFoundError: com/google/inject/servlet/GuiceServletContextListener
[WARN] failed JettyContainerService$ApiProxyHandler@eb4d977: java.lang.NoClassDefFoundError: com/google/inject/servlet/GuiceServletContextListener
[WARN] Error starting handlers
java.lang.NoClassDefFoundError: com/google/inject/servlet/GuiceServletContextListener
The class can be found at compile time though (my custom GuiceServletConfig extends GuiceServletContextListener and compiles properly).
The guice-servlet-3.0.jar
library appears both in the project build path and in the classpath of my Web Application Run Configuration in Eclipse.
The Arguments panel of my Run Configuration has the following config:
in Program arguments:
-remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -startupUrl TheFiveOrbs.jsp -logLevel INFO -server com.google.appengine.tools.development.gwt.AppEngineLauncher -port 8888 -codeServerPort 9997 -war "D:\Dev\Projects\The Five Orbs\trunk\target\fiveorbs-0.1" com.fiveorbs.TheFiveOrbs
in VM arguments:
-javaagent:D:\Dev\Programs\appengine-java-sdk\lib\agent\appengine-agent.jar -Xmx512m -Dappengine.sdk.root=D:\Dev\Programs\appengine-java-sdk
When I run mvn gae:run from the command prompt with Maven, everything is fine though - the server starts properly and no exception is shown.
I have been struggling with this issue for a couple of hours, and really cannot fathom why it occurs.
Thanks in advance for any hint you might be able to offer.
Sébastien
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
guice-servlet-3.0.jar
不应该位于您的启动配置类路径中,它应该位于您的D:\Dev\Projects\The Five Orbs\trunk 中\target\ Fiveorbs-0.1\WEB-INF\lib
文件夹。guice-servlet-3.0.jar
should not be in you launch configuration classpath, it should live in yourD:\Dev\Projects\The Five Orbs\trunk\target\fiveorbs-0.1\WEB-INF\lib
folder.