Open GoogleCodeExporter opened 9 years ago
Using the version from the trunk shows a more detailed error while binding a
custom
scope. Changing the module order fixes the problem with the trunk. The problem
still
exists in 2.0.
Original comment by w.schoen...@gmail.com
on 16 Apr 2010 at 1:54
Can you paste the error from 2.0?
Original comment by limpbizkit
on 16 Apr 2010 at 4:46
The stacktrace is from 2.0 (latest official release from maven repo). This is
the stack trace from the trunk version:
1) Error in custom provider, java.lang.NullPointerException
at de.cosmocode.palava.ipc.ConnectionAwareUnitOfWorkScopeModule.configure(ConnectionAwareUnitOfWorkScopeModule.java:41)
while locating de.cosmocode.palava.scope.UnitOfWorkScope
for parameter 0 at de.cosmocode.palava.scope.UnitOfWorkScopeAspect.setUnitOfWorkScope(UnitOfWorkScopeAspect.aj:40)
at de.cosmocode.palava.core.aop.AbstractPalavaAspect$1.configure(AbstractPalavaAspect.aj:46)
1 error
at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:379)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:183)
at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:117)
at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:90)
at com.google.inject.Guice.createInjector(Guice.java:105)
at com.google.inject.Guice.createInjector(Guice.java:90)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody0(DefaultFramework.java:97)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody1$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody2(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody3$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody4(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody5$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody6(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody7$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody8(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody9$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody10(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody11$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody12(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody13$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody14(DefaultFramework.java:1)
at de.cosmocode.palava.core.DefaultFramework.createInjector_aroundBody15$advice(DefaultFramework.java:74)
at de.cosmocode.palava.core.DefaultFramework.<init>(DefaultFramework.java:97)
at de.cosmocode.palava.core.Palava.createFramework(Palava.java:49)
at de.cosmocode.palava.core.Main.<init>(Main.java:99)
at de.cosmocode.palava.core.Main.main(Main.java:181)
Caused by: java.lang.NullPointerException
at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:145)
at com.google.inject.internal.ConstantFactory.get(ConstantFactory.java:34)
at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:43)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:878)
at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
at com.google.inject.Scopes$1$1.get(Scopes.java:64)
at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:80)
at com.google.inject.internal.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java:109)
at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:74)
at com.google.inject.internal.MembersInjectorImpl$1.call(MembersInjectorImpl.java:72)
at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:871)
at com.google.inject.internal.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java:72)
at com.google.inject.internal.Initializer$InjectableReference.get(Initializer.java:145)
at com.google.inject.internal.Initializer.injectAll(Initializer.java:90)
at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:181)
... 24 more
Original comment by w.schoen...@gmail.com
on 16 Apr 2010 at 7:09
Are you doing anything with threads? Do some of your object's constructors
spawn
other threads that require injection? Is it possible to narrow the problem
down to a
smaller full example?
Original comment by sberlin
on 17 Apr 2010 at 2:08
No, i do not spawn threads that require injection. The problem is, i can't
reproduce
the problem. I don't see a pattern when it occurs.
Original comment by w.schoen...@gmail.com
on 17 Apr 2010 at 5:18
Issue 471 has been merged into this issue.
Original comment by sberlin
on 19 Apr 2010 at 3:39
I nailed it down to a custom scope which requires injection:
final UnitOfWorkScope scope = ...;
binder.requestInjection(scope);
binder.bindScope(UnitOfWork.class, scope);
binder.bind(UnitOfWorkScope.class).toInstance(scope);
I removed the requestInjection(..) call with a constructor parameter which i
satisfy
with binder.getProvider(..), now everything seems to work.
Original comment by w.schoen...@gmail.com
on 28 Apr 2010 at 2:15
Awesome! Do you think you'd be able to write a test that consistently
reproduces the
failing behavior? If it's something we can support, that'll help to figure out
a fix
and verify it works.
It does make some sense that injecting into a Scope would fail, because how
would you
bootstrap it... but then again, if the Scope isn't scoped to itself, it should
theoretically be possible.
Original comment by sberlin
on 28 Apr 2010 at 4:46
(And, if nothing else, we can figure out a better error message to show, if it's
behavior we can't support.)
Original comment by sberlin
on 28 Apr 2010 at 4:46
The problem is: The scope is participating in the injection process of other
objects
through a custom injection listener which calls an initialize method on every
object.
This method may annotated with a custom annotation which itself is adviced by
an
aspect using the scope to enter and exit before and after the method
respectively.
After writing this, it sounds extremely scary...
Original comment by w.schoen...@gmail.com
on 28 Apr 2010 at 4:49
Take a look at this implementation of a concurrent singleton scope. Concurrent
injections and a request injection on a custom scope. Seems to work for him.
http://pastie.org/716802
Original comment by w.schoen...@gmail.com
on 1 May 2010 at 10:42
Bug is still alive! Please, fix it!
Original comment by abracham...@gmail.com
on 10 Dec 2011 at 6:55
Hi Abracham - any chance you could provide a testcase so we could recreate the
bug and verify potential fixes?
Original comment by mccu...@gmail.com
on 11 Dec 2011 at 12:49
Original issue reported on code.google.com by
w.schoen...@gmail.com
on 15 Apr 2010 at 4:10