bineanzhou / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

NPE at com.google.inject.InjectorImpl$LateBoundConstructor.get() #222

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
This bug was reproduced against guice "snapshot20080713"

Repro steps:

Check out warp-servlet/tags/warp-servlet-0.9_1 and run "ant assemble.jar".
The build will fail because InjectorImpl.java:478 throws a
NullPointerException. The full stack-trace follows:

FAILED: continueConvAcrossRequests
com.google.inject.ProvisionException: Guice provision errors:

   1) Error at [unknown source]:
    Error in custom provider, java.lang.NullPointerException
     while locating
com.wideplay.warp.servlet.conversation.CookieContinuationsTest$TestConvObject

   1 error[s]
       at com.google.inject.InjectorImpl$8.get(InjectorImpl.java:1015)
       at com.google.inject.InjectorImpl.getInstance(InjectorImpl.java:1042)
       at
com.wideplay.warp.servlet.conversation.CookieContinuationsTest$3.doFilter(Cookie
ContinuationsTest.java:200)
       at
com.wideplay.warp.servlet.FilterChainInvocation.doFilter(FilterChainInvocation.j
ava:54)
       at
com.wideplay.warp.servlet.ManagedFilterPipeline.dispatch(ManagedFilterPipeline.j
ava:50)
       at com.wideplay.warp.servlet.WebFilter.doFilter(WebFilter.java:64)
       at
com.wideplay.warp.servlet.conversation.CookieContinuationsTest.continueConvAcros
sRequests(CookieContinuationsTest.java:103)
   Caused by: java.lang.NullPointerException
       at
com.google.inject.InjectorImpl$LateBoundConstructor.get(InjectorImpl.java:478)
       at
com.google.inject.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFact
oryAdapter.java:43)
       at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:1065)
       at
com.google.inject.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactory
Adapter.java:40)
       at
com.wideplay.warp.servlet.conversation.ConversationManagerImpl.getAndPutIfAbsent
(ConversationManagerImpl.java:63)
       at com.wideplay.warp.servlet.Servlets$5$1.get(Servlets.java:205)
       at
com.google.inject.InternalFactoryToProviderAdapter.get(InternalFactoryToProvider
Adapter.java:47)
       at com.google.inject.InjectorImpl$8$1.call(InjectorImpl.java:1004)
       at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java:1057)
       at com.google.inject.InjectorImpl$8.get(InjectorImpl.java:998)
       ... 27 more
   ... Removed 21 stack frames

It's not clear to me what this test is doing wrong. Guice should throw a
cleaner error message.

Original issue reported on code.google.com by gili.tza...@gmail.com on 23 Jul 2008 at 3:14

GoogleCodeExporter commented 9 years ago
I tried debugging this further but quickly got lost. It seems that somehow an
injector context with a null injectionPoint gets used. It's not clear whether 
we're
reusing a dead context or never initializing it properly in the first place.

Original comment by gili.tza...@gmail.com on 23 Jul 2008 at 5:13

GoogleCodeExporter commented 9 years ago
This looks to me like the same problems as issue #136.

Original comment by sven.lin...@gmail.com on 21 Aug 2008 at 1:31

GoogleCodeExporter commented 9 years ago
Is there a workaround for this issue?

Original comment by gili.tza...@gmail.com on 23 Sep 2008 at 1:15

GoogleCodeExporter commented 9 years ago
Followed instructions but everything worked.  Also tried replacing the packaged 
guice jar with guice-3.0-rc2 but it still worked.

Original comment by sberlin on 19 Feb 2011 at 8:47