Hi

I have the following setup:

Injector-ModuleA-ChildInjectorA-ModuleB-ChildInjectorB-ModuleC-FinalChildInjector

\-----------ModuleD--------/

ModuleA is the core project where all base stuff are setup like JPA etc..

ModuleB needs to use JPA(get it injected), so therefore it needs to be
installed in childInjectorA

ModuleC & ModuleD uses stuff in ModuleB  so therefore needs to be in
childInjectorB so that it can get stuff from childinjectorA injected.

Problem are the one of the components in ModuleD gets this "It was
already configured on one or more child injectors or private modules"
to one of the references from ChildInjectorB which are strange since I
only define the class once. Intially I was not using private modules,
I've also tried using them and exposing the problematic interfaces but
it still fails.

Are there another way of getting things injected into modules? If I
somehow could use just one Injector it would probably work, but in
order todo that I need guice to manage the module instead of what I am
doing now:

Pseudo code:
                Injector injector= Guice
                                .createInjector(new ModuleA());

                ModuleB moduleB= new ModuleB();
                injector.injectMembers(moduleB);

                injector= injector.createChildInjector(moduleB);

                ModuleC moduleC= new ModuleC();
                ModuleD moduleD= new ModuleD();
                injector.injectMembers(moduleC);
                injector.injectMembers(moduleD);
                injector= injector.createChildInjector(moduleC,
                                moduleD);




Heres the full stack (real code), WallboardDataDriverModule=ModuleB and :

2011-10-20 11:24:35,723 WARN  [org.mortbay.log.Slf4jLog]  - failed
wicket.WicketWarp: com.google.inject.CreationException: Guice creation
errors:

1) Unable to create binding for
com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider. It
was already configured on one or more child injectors or private
modules
    bound at 
com.netdesign.wallboard.core.WallboardDataDriverModule.configure(WallboardDataDriverModule.java:35)
    bound at 
com.netdesign.wallboard.core.WallboardDataDriverModule.configure(WallboardDataDriverModule.java:33)
  If it was in a PrivateModule, did you forget to expose the binding?
  while locating
com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider
    for parameter 0 at
com.netdesign.dao.cisco.general.uccx.CiscoUCCXGeneralWallBoardViewerProvider.setWallBoardMainDataProvider(CiscoUCCXGeneralWallBoardViewerProvider.java:261)
  at 
com.netdesign.dao.cisco.general.uccx.CiscoUCCXGeneralWallBoardViewerProvider.setWallBoardMainDataProvider(CiscoUCCXGeneralWallBoardViewerProvider.java:261)
  while locating
com.netdesign.dao.cisco.v8.uccx.CiscoUCCX8WallBoardViewerProvider

1 error
2011-10-20 11:24:35,723 ERROR [org.mortbay.log.Slf4jLog]  - Failed
startup of context
org.mortbay.jetty.webapp.WebAppContext@67d5fe{,src/main/webapp}
com.google.inject.CreationException: Guice creation errors:

1) Unable to create binding for
com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider. It
was already configured on one or more child injectors or private
modules
    bound at 
com.netdesign.wallboard.core.WallboardDataDriverModule.configure(WallboardDataDriverModule.java:35)
    bound at 
com.netdesign.wallboard.core.WallboardDataDriverModule.configure(WallboardDataDriverModule.java:33)
  If it was in a PrivateModule, did you forget to expose the binding?
  while locating
com.netdesign.wallboard.core.interfaces.WallBoardMainDataProvider
    for parameter 0 at
com.netdesign.dao.cisco.general.uccx.CiscoUCCXGeneralWallBoardViewerProvider.setWallBoardMainDataProvider(CiscoUCCXGeneralWallBoardViewerProvider.java:261)
  at 
com.netdesign.dao.cisco.general.uccx.CiscoUCCXGeneralWallBoardViewerProvider.setWallBoardMainDataProvider(CiscoUCCXGeneralWallBoardViewerProvider.java:261)
  while locating
com.netdesign.dao.cisco.v8.uccx.CiscoUCCX8WallBoardViewerProvider

1 error
        at 
com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
        at 
com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:154)
        at 
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
        at 
com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:217)
        at 
com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:224)
        at 
com.netdesign.wallboard.application.WicketApplication.getDevelopmentInjector(WicketApplication.java:115)
        at 
com.netdesign.wallboard.application.WicketApplication.getGuiceInjector(WicketApplication.java:91)
        at 
com.netdesign.wallboard.application.WicketApplication.init(WicketApplication.java:71)
        at org.apache.wicket.Application.initApplication(Application.java:805)
        at 
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:346)
        at 
org.apache.wicket.protocol.http.WicketFilter.init(WicketFilter.java:286)
        at org.mortbay.jetty.servlet.FilterHolder.doStart(FilterHolder.java:97)
        at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at 
org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:662)
        at org.mortbay.jetty.servlet.Context.startContext(Context.java:140)
        at 
org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1272)
        at 
org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517)
        at 
org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:489)
        at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at 
org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130)
        at org.mortbay.jetty.Server.doStart(Server.java:224)
        at 
org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50)
        at com.netdesign.wallboard.Start.main(Start.java:47)
2011-10-20 11:24:35,739 INFO  [org.mortbay.log.Slf4jLog]  - Started
[email protected]:8080

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

Reply via email to