Error when using Guice on Android

3,460 views
Skip to first unread message

Efi Merdler

unread,
Sep 7, 2011, 6:47:15 PM9/7/11
to google-guice
Hi Guys,

I'm using Guice no_aop v 3.0 with assisted inject extension in my
project.

The moment I'm calling the createInjector method I'm receiving a nasty
error:

09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): Could not load
Finalizer in its own class loader. Loading Finalizer in the current
class loader instead. As a result, you will not be able to garbage
collect this class loader. To support reclaiming this class loader,
either resolve the underlying issue, or move Google Collections to
your system class path.
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451):
java.io.FileNotFoundException: com/google/inject/internal/util/
$Finalizer.class
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.google.inject.internal.util.$FinalizableReferenceQueue
$DecoupledLoader.getBaseUrl(FinalizableReferenceQueue.java:269)
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.google.inject.internal.util.$FinalizableReferenceQueue
$DecoupledLoader.loadFinalizer(FinalizableReferenceQueue.java:253)
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.google.inject.internal.util.
$FinalizableReferenceQueue.loadFinalizer(FinalizableReferenceQueue.java:
175)
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.google.inject.internal.util.
$FinalizableReferenceQueue.<clinit>(FinalizableReferenceQueue.java:
100)
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.google.inject.internal.util.$MapMaker
$QueueHolder.<clinit>(MapMaker.java:787)
...
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.blinx.widget.Module.configure(Module.java:29)
09-08 01:18:29.778: WARN/nalizableReferenceQueue(7451): at
com.google.inject.AbstractModule.configure(AbstractModule.java:59)

...
09-08 01:18:29.988: ERROR/AndroidRuntime(7451): FATAL EXCEPTION: main
09-08 01:18:29.988: ERROR/AndroidRuntime(7451):
java.lang.RuntimeException: Unable to start receiver
com.blinx.widget.view.BlinxWidget: com.google.inject.internal.util.
$ComputationException: java.lang.VerifyError:
com.google.inject.internal.cglib.core.$ReflectUtils
...
09-08 01:18:29.988: ERROR/AndroidRuntime(7451): Caused by:
com.google.inject.internal.util.$ComputationException:
java.lang.VerifyError: com.google.inject.internal.cglib.core.
$ReflectUtils


When removing the following line from my Module:
install(new FactoryModuleBuilder()
.build(ChannelFactory.class));

It seems to work.

What am I missing ?

Thanks,
Efi

Sam Berlin

unread,
Sep 9, 2011, 11:29:17 AM9/9/11
to google...@googlegroups.com
Is it possible you may also have the normal Guice 3.0 on your classpath also (perhaps leaked onto the classpath as a dependency of assisted inject)?  The error is appearing from something that is not included in the no_aop version.

sam


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


Martin Dobmeier

unread,
Sep 13, 2011, 3:12:17 PM9/13/11
to google-guice
Hi,

I'm also seeing this stacktrace on Android with guice-3.0_no-aop.jar.
Furthermore, I'm having guava-r09.jar and javax.inject.jar on the
classpath.

Do you have any idea what is causing the exception? As you can see the
exception is logged on level WARN. Can I therefore ignore it?

Thanks
Martin

P.S.: Here's the stacktrace I'm seeing:

09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): Could not load
Finalizer in its own class loader. Loading Finalizer in the current
class loader instead. As a result, you will not be able to garbage
collect this class loader. To support reclaiming this class loader,
either resolve the underlying issue, or move Google Collections to
your system class path.
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186):
java.io.FileNotFoundException: com/google/inject/internal/util/
$Finalizer.class
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$FinalizableReferenceQueue
$DecoupledLoader.getBaseUrl(FinalizableReferenceQueue.java:269)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$FinalizableReferenceQueue
$DecoupledLoader.loadFinalizer(FinalizableReferenceQueue.java:253)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.
$FinalizableReferenceQueue.loadFinalizer(FinalizableReferenceQueue.java:
175)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.
$FinalizableReferenceQueue.<clinit>(FinalizableReferenceQueue.java:
100)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$MapMaker
$QueueHolder.<clinit>(MapMaker.java:787)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$MapMaker
$WeakEntry.<init>(MapMaker.java:946)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$MapMaker$Strength
$1.newEntry(MapMaker.java:312)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$MapMaker
$StrategyImpl.newEntry(MapMaker.java:498)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$MapMaker
$StrategyImpl.newEntry(MapMaker.java:419)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.util.$CustomConcurrentHashMap
$ComputingImpl.get(CustomConcurrentHashMap.java:2029)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.Annotations
$AnnotationChecker.hasAnnotations(Annotations.java:116)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.Annotations.isBindingAnnotation(Annotations.java:
180)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.Key.ensureIsBindingAnnotation(Key.java:366)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.Key.strategyFor(Key.java:353)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.Key.get(Key.java:264)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.AbstractBindingBuilder.annotatedWithInternal(AbstractBindingBuilder.java:
74)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.BindingBuilder.annotatedWith(BindingBuilder.java:
49)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.BindingBuilder.annotatedWith(BindingBuilder.java:
41)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
de.bmwgroup.xfcd.guice.BaseModule.configureDriveManagerCommunication(BaseModule.java:
56)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
de.bmwgroup.xfcd.guice.ProductionModule.configure(ProductionModule.java:
39)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.AbstractModule.configure(AbstractModule.java:59)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:
223)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.spi.Elements.getElements(Elements.java:101)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.spi.Elements.getElements(Elements.java:92)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.util.Modules$RealOverriddenModuleBuilder
$1.configure(Modules.java:152)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.AbstractModule.configure(AbstractModule.java:59)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:
223)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.spi.Elements.getElements(Elements.java:101)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.InjectorShell
$Builder.build(InjectorShell.java:133)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:
103)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.Guice.createInjector(Guice.java:95)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.Guice.createInjector(Guice.java:72)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
com.google.inject.Guice.createInjector(Guice.java:62)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at ...
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at ...
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at ...
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
android.os.AsyncTask$2.call(AsyncTask.java:185)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:
1068)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
java.util.concurrent.ThreadPoolExecutor
$Worker.run(ThreadPoolExecutor.java:561)
09-13 20:20:26.469: WARN/nalizableReferenceQueue(2186): at
java.lang.Thread.run(Thread.java:1096)

Sam Berlin

unread,
Sep 13, 2011, 3:22:19 PM9/13/11
to google...@googlegroups.com
All of those logging statements are just warnings, and are harmless.  They will be removed once Guice changes to use the Guava release (r10.. I'm not entirely sure if r09 had the fix).

My earlier response was directed at the ERROR messages printed out at the bottom of the initial post.

sam

Martin Dobmeier

unread,
Sep 13, 2011, 4:18:57 PM9/13/11
to google...@googlegroups.com
Ok, thanks very much. Good to know.

Martin

P.S.: Now that you mention it ... I didn't notice the ERROR messages at the bottom.
Message has been deleted

Igor Ganapolsky

unread,
Mar 3, 2015, 8:57:40 PM3/3/15
to google...@googlegroups.com
Umm, it's 2015, and these warning are not removed.  In fact they happen when using Dagger too.

Stuart McCulloch

unread,
Mar 3, 2015, 9:26:57 PM3/3/15
to google...@googlegroups.com
What version of Guice (and Guava) are you using in your project?

Guava stopped using the FinalizableReferenceQueue for its CustomConcurrentHashMap in v10, and Guice picked up this fix in 4.0-beta

If you’re still seeing those warnings with recent versions of Guice and Guava then something else is using FinalizableReferenceQueue
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.

To post to this group, send email to google...@googlegroups.com.

Sam Berlin

unread,
Mar 3, 2015, 9:29:52 PM3/3/15
to google...@googlegroups.com

If you're seeing this warning when using Dagger, then it clearly isn't coming from Guice... because you aren't using Guice.  Given that Dagger doesn't use Guava at runtime, the error must be coming from other code you're using.

sam


To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages