杜松子酒编译有问题



我正在使用Gin 1.5和GWT 2.4在添加Gin之前,项目构建得很好,但现在没有了:

    [ERROR] [foo] - Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'com.foo.html.client.FooGinjector'

错误为:

20:58:04.252 [ERROR] [foo] Generator 'com.google.gwt.inject.rebind.GinjectorGenerator' threw an exception while rebinding 'com.foo.html.client.FooGinjector'
com.google.inject.internal.ComputationException: java.lang.NoClassDefFoundError: com/google/inject/assistedinject/Assisted
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:46)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:121)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:443)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:698)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
    at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:45)
    at com.google.inject.internal.BindingProcessor.runCreationListeners(BindingProcessor.java:238)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:143)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:116)
    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:90)
    at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:47)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
    at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.client.GWT.create(GWT.java:97)
    at com.foo.html.client.FooGameHtml.<init>(FooGameHtml.java:39)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError: com/google/inject/assistedinject/Assisted
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getDeclaredConstructors(Unknown Source)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:232)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:92)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:489)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:696)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.createProviderBinding(InjectorImpl.java:281)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:662)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
    at com.google.inject.internal.InjectorImpl.createParameterInjector(InjectorImpl.java:772)
    at com.google.inject.internal.InjectorImpl.getParametersInjectors(InjectorImpl.java:760)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:55)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:27)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:35)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
    at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:46)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:121)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:443)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:698)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
    at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:45)
    at com.google.inject.internal.BindingProcessor.runCreationListeners(BindingProcessor.java:238)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:143)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:116)
    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:90)
    at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:47)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
    at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.client.GWT.create(GWT.java:97)
    at com.foo.html.client.FooGameHtml.<init>(FooGameHtml.java:39)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.google.inject.assistedinject.Assisted
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
    at java.lang.Class.getDeclaredConstructors(Unknown Source)
    at com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:232)
    at com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:92)
    at com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:489)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:696)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.createProviderBinding(InjectorImpl.java:281)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:662)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
    at com.google.inject.internal.InjectorImpl.createParameterInjector(InjectorImpl.java:772)
    at com.google.inject.internal.InjectorImpl.getParametersInjectors(InjectorImpl.java:760)
    at com.google.inject.internal.ConstructorInjectorStore.createConstructor(ConstructorInjectorStore.java:55)
    at com.google.inject.internal.ConstructorInjectorStore.access$000(ConstructorInjectorStore.java:27)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:35)
    at com.google.inject.internal.ConstructorInjectorStore$1.create(ConstructorInjectorStore.java:33)
    at com.google.inject.internal.FailableCache$1.apply(FailableCache.java:35)
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:549)
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcurrentHashMap.java:2041)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:46)
    at com.google.inject.internal.ConstructorInjectorStore.get(ConstructorInjectorStore.java:48)
    at com.google.inject.internal.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:121)
    at com.google.inject.internal.InjectorImpl.initializeJitBinding(InjectorImpl.java:443)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:698)
    at com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:630)
    at com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:223)
    at com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:174)
    at com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:704)
    at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:45)
    at com.google.inject.internal.BindingProcessor.runCreationListeners(BindingProcessor.java:238)
    at com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:143)
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:116)
    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:90)
    at com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:47)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generate(GeneratorExtWrapper.java:48)
    at com.google.gwt.core.ext.GeneratorExtWrapper.generateIncrementally(GeneratorExtWrapper.java:60)
    at com.google.gwt.dev.javac.StandardGeneratorContext.runGeneratorIncrementally(StandardGeneratorContext.java:647)
    at com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:41)
    at com.google.gwt.dev.shell.StandardRebindOracle$Rebinder.rebind(StandardRebindOracle.java:78)
    at com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:268)
    at com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:141)
    at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:585)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:455)
    at com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:49)
    at com.google.gwt.core.client.GWT.create(GWT.java:97)
    at com.foo.html.client.FooGameHtml.<init>(FooGameHtml.java:39)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:465)
    at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:375)
    at com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:200)
    at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:525)
    at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:363)
    at java.lang.Thread.run(Unknown Source)

我做错了什么?我的类路径中有guice-assistedinject-snapshot.jarguice-snapshot.jar,按顺序排列。

导致错误的行在我的入口点类中是:

private final FooGinjector injector = GWT.create(FooGinjector.class);

FooGijector.java:

@GinModules(FooGinModule.class)
public interface FooGinjector extends Ginjector {
  EventBus eventBus();
  PlaceHistoryHandler historyHandler();
}

我将assisteinject jar移到类路径中的其他gin jar之上,现在它似乎工作得很好。

当我第一次看到它时,我想到gwt.xml 中缺少明显的模块继承

<!-- Other module inherits                                      -->
  <inherits name="com.google.gwt.inject.Inject"/>

既然你回答了自己的问题,我想我应该添加一些转换为GIN时发现的其他内容。

根据我在网上找到的部分教程,我将HelloMVP应用程序转换为GIN。我发现在Activities&如果您不熟悉guide语法,有些地方会变得更加复杂。

如果你继续尝试用位置运行代码,你需要知道GINModule的配置方法中正确的绑定语法:

bind(SimplePanel.class).in(Singleton.class);
bind(EventBus.class).to(SimpleEventBus.class).in(Singleton.class);
//Notice that the interface must be declared first, then the implementation on the binding.
bind(PlaceHistoryMapper.class).to(AppPlaceHistoryMapper.class).in(Singleton.class);
bind(ActivityMapper.class).to(AppActivityMapper.class).in(Singleton.class);
etc...

这让我有一段时间感到困惑,因为我不知道如何在这里声明singleton。我不知道你是否克服了这个问题。

相关内容

  • 没有找到相关文章

最新更新