Cannot inject the injector in a eager singleton

22 views
Skip to first unread message

Célio

unread,
Jun 30, 2010, 3:09:01 PM6/30/10
to google-gin
In our app there are some cases where we need to inject the injector
in a eager singleton. When we try to do that, this is what happens:


--- BEGIN -----------

00:00:49,453 [ERROR] Errors from Guice: Guice creation errors: 1) No
implementation for foo.MyInjector was bound. while locating
foo.MyInjector for field at
foo.MyEagerSingleton.injector(MyEagerSingleton.java:39) at
foo.MyInjectorModule.configure(MyGinModule.java:102) 1 error
com.google.inject.CreationException: Guice creation errors:

1) No implementation for foo.MyInjector was bound.
while locating foo.MyInjector
for field at foo.MyEagerSingleton.injector(MyEagerSingleton.java:
39)
at foo.MyInjectorModule.configure(MyGinModule.java:102)

1 error at
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:
358) at
com.google.inject.internal.InjectorBuilder.initializeStatically(InjectorBuilder.java:
153) at
com.google.inject.internal.InjectorBuilder.build(InjectorBuilder.java:
106) at com.google.inject.Guice.createInjector(Guice.java:93) at
com.google.gwt.inject.rebind.BindingsProcessor.validateModulesUsingGuice(BindingsProcessor.java:
370) at
com.google.gwt.inject.rebind.BindingsProcessor.process(BindingsProcessor.java:
212) at
com.google.gwt.inject.rebind.GinjectorGeneratorImpl.generate(GinjectorGeneratorImpl.java:
76) at
com.google.gwt.inject.rebind.GinjectorGenerator.generate(GinjectorGenerator.java:
47) at
com.google.gwt.dev.javac.StandardGeneratorContext.runGenerator(StandardGeneratorContext.java:
418) at
com.google.gwt.dev.cfg.RuleGenerateWith.realize(RuleGenerateWith.java:
38) at com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.tryRebind(StandardRebindOracle.java:108) at
com.google.gwt.dev.shell.StandardRebindOracle
$Rebinder.rebind(StandardRebindOracle.java:54) at
com.google.gwt.dev.shell.StandardRebindOracle.rebind(StandardRebindOracle.java:
154) at
com.google.gwt.dev.shell.ShellModuleSpaceHost.rebind(ShellModuleSpaceHost.java:
119) at com.google.gwt.dev.shell.ModuleSpace.rebind(ModuleSpace.java:
531) at
com.google.gwt.dev.shell.ModuleSpace.rebindAndCreate(ModuleSpace.java:
414) at
com.google.gwt.dev.shell.GWTBridgeImpl.create(GWTBridgeImpl.java:39)
at com.google.gwt.core.client.GWT.create(GWT.java:98) at
foo.MyGinModule.<init>(MyGinModule.java:47) 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:
422) at com.google.gwt.dev.shell.ModuleSpace.onLoad(ModuleSpace.java:
361) at
com.google.gwt.dev.shell.OophmSessionHandler.loadModule(OophmSessionHandler.java:
185) at
com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:
380) at
com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:
222) at java.lang.Thread.run(Unknown Source)

--- END -----------


I'm not sure whether this is actually possible, a bug, or a mistake of
mine. May some of you guys shed some light on that.

Regards,
Célio

Peter Schmitt

unread,
Jul 5, 2010, 11:25:34 AM7/5/10
to googl...@googlegroups.com
Hi Célio,

I wrote a number of tests (see here: http://codereview.appspot.com/1666049) that should check your problem but they all succeed for me. Which version of Gin are you using (I only tested against trunk)?

Peter


--
You received this message because you are subscribed to the Google Groups "google-gin" group.
To post to this group, send email to googl...@googlegroups.com.
To unsubscribe from this group, send email to google-gin+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-gin?hl=en.


Reply all
Reply to author
Forward
0 new messages