On 18 Dec 2013, at 13:34, Jochen Wiedmann <[email protected]> wrote:
> Thanks, Stuart,
> 
> okay, that's understood. But, what is the error? Note, that I was binding 
> PropertyFactory (an interface), but the error message indicates that 
> PropertyFactoryImpl (the implementation) wasn't bound?

What does PropertyFactoryImpl look like?

> Jochen
> 
> On Wednesday, December 18, 2013 1:11:48 PM UTC+1, Stuart McCulloch wrote:
> On 18 Dec 2013, at 08:30, Jochen Wiedmann <[email protected]> wrote:
> 
>> I was able to reduce the problem down to the following:
>> 
>>         final Module module = new Module(){
>>             public void configure(Binder binder) {
>>                 
>> binder.bind(PropertyFactory.class).to(PropertyFactoryImpl.class).in(Scopes.SINGLETON);
>>             }
>>         };
>>         Guice.createInjector(Stage.PRODUCTION, module); // Throws exception.
> 
> ^ with Stage.PRODUCTION any bound singletons are eagerly instantiated during 
> injector startup (ie. during Guice.createInjector)
> 
>       
> https://code.google.com/p/google-guice/wiki/Bootstrap#Phase_3:_Singleton_Preloading
> 
> this exposes the error early on - if you change this to Stage.DEVELOPMENT 
> you’ll only see the error when requesting the instance
> 
>> And here's the stack trace:
>> 
>> com.google.inject.CreationException: Guice creation errors:
>> 
>> 1) No implementation for 
>> com.github.jochen.afw.core.props.impl.PropertyFactoryImpl was bound.
>>   at 
>> com.github.jochen.afw.core.props.impl.PropertyFactoryImplTest$1.configure(PropertyFactoryImplTest.java:33)
>> 
>> 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.Guice.createInjector(Guice.java:95)
>>     at com.google.inject.Guice.createInjector(Guice.java:83)
>>     at 
>> com.github.jochen.afw.core.props.impl.PropertyFactoryImplTest.testNativeGuice(PropertyFactoryImplTest.java:36)
>>     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>     at 
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>>     at 
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>>     at java.lang.reflect.Method.invoke(Method.java:592)
>>     at 
>> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
>>     at 
>> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>>     at 
>> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
>>     at 
>> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>>     at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
>>     at 
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
>>     at 
>> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>>     at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
>>     at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
>>     at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
>>     at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
>>     at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
>>     at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>>     at 
>> org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
>>     at 
>> org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
>>     at 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
>>     at 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
>>     at 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
>>     at 
>> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
>> 
>> 
>> 
>> 
>> 
>> On Tuesday, December 17, 2013 1:51:20 PM UTC+1, scl wrote:
>> could you post the configure method of your CoreModule 
>> 
>> 
>> 
>> On 12/17/2013 12:14 PM, Jochen Wiedmann wrote: 
>> > 
>> > Hi, 
>> > 
>> > in a module, I get the error message: 
>> > 
>> > com.google.inject.CreationException: Guice creation errors: 
>> > 
>> > 1) No implementation for com.foo.PropertyFactoryImpl was bound. 
>> >   at com.foo.CoreModule.configure(CoreModule.java:66) 
>> > 
>> > While that message might make perfect sense when injecting a value, it 
>> > occurs within binder.bind(Class), where I don't understand it at all. 
>> > 
>> > Any explanations? 
>> > 
>> > Thanks, 
>> > 
>> > Jochen 
>> > 
>> > -- 
>> > You received this message because you are subscribed to the Google 
>> > Groups "google-guice" group. 
>> > To unsubscribe from this group and stop receiving emails from it, send 
>> > an email to [email protected]. 
>> > To post to this group, send email to [email protected]. 
>> > Visit this group at http://groups.google.com/group/google-guice. 
>> > For more options, visit https://groups.google.com/groups/opt_out. 
>> 
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "google-guice" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected].
>> To post to this group, send email to [email protected].
>> Visit this group at http://groups.google.com/group/google-guice.
>> For more options, visit https://groups.google.com/groups/opt_out.
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "google-guice" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/google-guice.
> For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-guice.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to