NoClassDefFoundError with Gin 1.5 and GWT 2.4



我正在尝试按照此 GWT MVP 教程将 GWT 网络应用程序放在一起,但使用所用库的较新版本,因为并非所有库都可用或与 GWT 2.4 不兼容。

问题是,当我运行项目时,我得到以下内容到控制台:

Starting Jetty on port 8888
[WARN] failed com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload@6ee76fcc{/,/home/raido/Kood/workspaceJava/gwtmvp/war}
java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions
at com.google.inject.servlet.ServletModule.configure(ServletModule.java:44)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:135)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:113)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:101)
at com.google.inject.Guice.createInjector(Guice.java:105)
at com.google.inject.Guice.createInjector(Guice.java:76)
at com.google.inject.Guice.createInjector(Guice.java:63)
at gwtmvp.server.guice.GuiceServletConfig.getInjector(GuiceServletConfig.java:11)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.util.$Preconditions
at java.lang.ClassLoader.findClass(ClassLoader.java:373)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
... 30 more
[WARN] failed RequestLogHandler@4113a03d
java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions
at com.google.inject.servlet.ServletModule.configure(ServletModule.java:44)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:135)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:113)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:101)
at com.google.inject.Guice.createInjector(Guice.java:105)
at com.google.inject.Guice.createInjector(Guice.java:76)
at com.google.inject.Guice.createInjector(Guice.java:63)
at gwtmvp.server.guice.GuiceServletConfig.getInjector(GuiceServletConfig.java:11)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.util.$Preconditions
at java.lang.ClassLoader.findClass(ClassLoader.java:373)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
... 30 more
[WARN] Error starting handlers
java.lang.NoClassDefFoundError: com/google/inject/internal/util/$Preconditions
at com.google.inject.servlet.ServletModule.configure(ServletModule.java:44)
at com.google.inject.AbstractModule.configure(AbstractModule.java:59)
at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)
at com.google.inject.spi.Elements.getElements(Elements.java:101)
at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:135)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:113)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:101)
at com.google.inject.Guice.createInjector(Guice.java:105)
at com.google.inject.Guice.createInjector(Guice.java:76)
at com.google.inject.Guice.createInjector(Guice.java:63)
at gwtmvp.server.guice.GuiceServletConfig.getInjector(GuiceServletConfig.java:11)
at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
at org.mortbay.jetty.handler.ContextHandler.startContext(ContextHandler.java:543)
at org.mortbay.jetty.servlet.Context.startContext(Context.java:136)
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1220)
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:513)
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:448)
at com.google.gwt.dev.shell.jetty.JettyLauncher$WebAppContextWithReload.doStart(JettyLauncher.java:468)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.handler.RequestLogHandler.doStart(RequestLogHandler.java:115)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
at org.mortbay.jetty.Server.doStart(Server.java:222)
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:39)
at com.google.gwt.dev.shell.jetty.JettyLauncher.start(JettyLauncher.java:672)
at com.google.gwt.dev.DevMode.doStartUpServer(DevMode.java:509)
at com.google.gwt.dev.DevModeBase.startUp(DevModeBase.java:1068)
at com.google.gwt.dev.DevModeBase.run(DevModeBase.java:811)
at com.google.gwt.dev.DevMode.main(DevMode.java:311)
Caused by: java.lang.ClassNotFoundException: com.google.inject.internal.util.$Preconditions
at java.lang.ClassLoader.findClass(ClassLoader.java:373)
at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:352)
at org.mortbay.jetty.webapp.WebAppClassLoader.loadClass(WebAppClassLoader.java:337)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:334)
... 30 more

项目所需的库与我拥有的库:

  • 杜松子酒.jar ---杜松子酒-1.5-后-GWT-2.2.jar (杜松子酒-1.5)
  • AOPALLIANCE.jar(来自Google Gin) --- AOPALLIANCE.jar(Gin-1.5)
  • guice-2.0.jar(来自谷歌杜松子酒。重要提示 - 使用与 Gin 而不是 Guice 一起提供的版本) --- guice-snapshot.jar (gin-1.5)
  • guice-servlet-2.0.jar (来自Google Guice) --- guice-servlet-3.0.jar (guice-3.0
  • gwt-dispatch-1.0.0-SNAPSHOT.jar (来自 GWT-dispatch) --- GWT-dispatch-1.2.0.jar
  • GWT-log-2.6.2.jar(来自 GWT-log)--- GWT-log-3.1.8.jar
  • gwt-presenter-1.0.0-SNAPSHOT.jar (来自 GWT-presenter) --- GWT-presenter-1.0.0.jar
  • log4j.jar (来自 log4j) --- log4j-1.2.16.jar

Gwt-presenter还有一个更新的版本1.1.1,它导致了额外的问题,所以我回到了1.0.0,但那是另一回事了。

我已将代码上传到GitHub。其中大部分只是从上述教程中复制粘贴,差异很小。

您发布的库

guice-2.0.jar (from Google Gin. IMPORTANT - use the version supplied with Gin and not Guice) --- guice-snapshot.jar (gin-1.5)
guice-servlet-2.0.jar (from Google Guice) --- guice-servlet-3.0.jar (guice-3.0)

似乎在碰撞。似乎您在类路径中Guice 2.0.jarGuice 3.0.jar。只保留Guice 3.0.jar .这应该可以解决您的问题。

我遵循了相同的教程,我尝试像您一样使用更新的 JARS,并且我发现了与您在此处看到的相同的错误:GWT、Guice 和 GIN 编译。该问题是由于某些缺少JARS,特别是Guice-3.0.jar引起的。

非常需要的JAR在你的类路径中:这应该可以解决问题。

相关内容

  • 没有找到相关文章

最新更新