我正在使用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.jar
和guice-snapshot.jar
,按顺序排列。
导致错误的行在我的入口点类中是:
private final FooGinjector injector = GWT.create(FooGinjector.class);
FooGinjector.java:
@GinModules(FooGinModule.class)
public interface FooGinjector extends Ginjector {
EventBus eventBus();
PlaceHistoryHandler historyHandler();
}
答案 0 :(得分:2)
我将辅助注入jar移到了类路径中的其他杜松子酒罐上方,现在看起来工作正常。
答案 1 :(得分:0)
当我第一次看到这个时,我想到gwt.xml中缺少明显的模块继承
<!-- Other module inherits -->
<inherits name="com.google.gwt.inject.Inject"/>
既然你回答了自己的问题,我想我会在转换为GIN时添加我发现的其他内容。
我将HelloMVP应用程序转换为GIN,基于我在网络上找到的部分教程。 我发现的是添加活动&amp;如果你不熟悉guice语法,那么它就会变得更加复杂。
如果你继续尝试用地方运行代码,你需要知道GINModule的configure方法中正确的绑定语法:
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...
这个人扔了我一会儿,因为我不知道如何在这里宣布单身人士。我不知道你是否已经过了这个问题。