Morning folks, just FYI:

I accidentally bound an interface to an abstract class (forgot to
un-abstract it after some refactoring) and got an NPE in
BindingBuilderImpl$FactoryProxy:

com.google.inject.ProvisionException: Error while locating instance
  bound to info.cathdb.funcnet_0_1.sessiondb.Repository
  for member at
info.cathdb.funcnet_0_1.sessiondb.hib3impl.RepositoryTest._repository(RepositoryTest.java:1)
        at 
com.google.inject.InjectorImpl$SingleFieldInjector.inject(InjectorImpl.java:486)
        at com.google.inject.InjectorImpl.injectMembers(InjectorImpl.java:674)
        at com.google.inject.InjectorImpl$8.call(InjectorImpl.java:682)
        at com.google.inject.InjectorImpl$8.call(InjectorImpl.java:681)
        at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:747)
        at com.google.inject.InjectorImpl.injectMembers(InjectorImpl.java:680)
        at 
info.cathdb.funcnet_0_1.sessiondb.hib3impl.RepositoryTest.setUp(RepositoryTest.java:45)
        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:597)
        at 
org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
        at 
org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
        at 
org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:27)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:73)
        at 
org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:46)
        at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:180)
        at org.junit.runners.ParentRunner.access$000(ParentRunner.java:41)
        at org.junit.runners.ParentRunner$1.evaluate(ParentRunner.java:173)
        at 
org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
        at 
org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:31)
        at org.junit.runners.ParentRunner.run(ParentRunner.java:220)
        at 
org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:45)
        at 
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
        at 
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: java.lang.NullPointerException
        at 
com.google.inject.BindingBuilderImpl$FactoryProxy.get(BindingBuilderImpl.java:299)
        at 
com.google.inject.InjectorImpl$SingleFieldInjector.inject(InjectorImpl.java:473)
        ... 29 more

Caused some headscratching -- especially since I'm used to Guice's
(normally) incredibly informative errors.

Anyway, this might be fixed by now, just thought I'd bring it to your
attention if it isn't.

The offending line was just a simple bind-to:

        bind( Repository.class ).to( HibernateRepository.class );

where HibernateRepository was the accidentally abstract one. The line
that caused the error was an injectMembers(this) on a class with

    @Inject private Repository _repository;

Cheers,

Andrew.

--~--~---------~--~----~------------~-------~--~----~
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