gpt4 book ai didi

java - Gin 1.5 和 GWT 2.4 出现 NoClassDefFoundError

转载 作者:行者123 更新时间:2023-12-02 00:25:53 25 4
gpt4 key购买 nike

我正在尝试按照 this GWT MVP tutorial 组合一个 GWT Web 应用程序但使用已用库的较新版本,因为并非所有库都可用或与 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

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

  • gin.jar --- gin-1.5-post-gwt-2.2.jar (gin-1.5)
  • aopalliance.jar(来自 Google Gin) --- aopalliance.jar (gin-1.5)
  • guice-2.0.jar(来自 Google Gin。重要 - 使用 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。这应该可以解决您的问题。

关于java - Gin 1.5 和 GWT 2.4 出现 NoClassDefFoundError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10066262/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com