Does guice 3.0's work? sam On Apr 17, 2012 7:20 AM, "Nyte" <[email protected]> wrote:
> Hi everyone, > > I have a problem with Guice 2.0's assisted injection feature in an > OSGi environment. I did a simple project which uses assisted injection > to produce Animals (Cats and Dogs) using an AnimalFactory interface. > The project works perfectly OK if it is a normal Java project (non- > OSGi). If I use the same code in an OSGi project, an exception is > thrown upon the project startup. Whenever I run it, the following > exception is thrown: > > java.lang.IllegalAccessError: tried to access class > com.google.inject.assistedinject.FactoryProvider2 from class > $com.google.inject.assistedinject.FactoryProvider2$$FastClassByGuice$ > $9dcdf6d7 > at $com.google.inject.assistedinject.FactoryProvider2$ > $FastClassByGuice$$9dcdf6d7.invoke(<generated>) > at > com.google.inject.internal.cglib.reflect.FastMethod.invoke(FastMethod.java: > 53) > at com.google.inject.SingleMethodInjector > $1.invoke(SingleMethodInjector.java:59) > at > com.google.inject.SingleMethodInjector.inject(SingleMethodInjector.java: > 91) > at > > com.google.inject.MembersInjectorImpl.injectMembers(MembersInjectorImpl.java: > 99) > at com.google.inject.MembersInjectorImpl > $1.call(MembersInjectorImpl.java:76) > at com.google.inject.MembersInjectorImpl > $1.call(MembersInjectorImpl.java:74) > at com.google.inject.InjectorImpl.callInContext(InjectorImpl.java: > 804) > at > > com.google.inject.MembersInjectorImpl.injectAndNotify(MembersInjectorImpl.java: > 74) > at com.google.inject.Initializer > $InjectableReference.get(Initializer.java:145) > at com.google.inject.Initializer.injectAll(Initializer.java:92) > at > com.google.inject.InjectorBuilder.injectDynamically(InjectorBuilder.java: > 171) > at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:113) > at com.google.inject.Guice.createInjector(Guice.java:92) > at com.google.inject.Guice.createInjector(Guice.java:69) > at com.google.inject.Guice.createInjector(Guice.java:59) > at > com.seeburger.guicetest.AnimalTest.testAnimalFactory(AnimalTest.java: > 25) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at junit.framework.TestCase.runTest(TestCase.java:168) > at junit.framework.TestCase.runBare(TestCase.java:134) > at junit.framework.TestResult$1.protect(TestResult.java:110) > at junit.framework.TestResult.runProtected(TestResult.java:128) > at junit.framework.TestResult.run(TestResult.java:113) > at junit.framework.TestCase.run(TestCase.java:124) > at junit.framework.TestSuite.runTest(TestSuite.java:243) > at junit.framework.TestSuite.run(TestSuite.java:238) > at > org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java: > 83) > 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.pde.internal.junit.runtime.RemotePluginTestRunner.main(RemotePluginTestRunner.java: > 62) > at > > org.eclipse.pde.internal.junit.runtime.CoreTestApplication.run(CoreTestApplication.java: > 23) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at > > org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java: > 587) > at > > org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java: > 198) > at > > org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java: > 110) > at > > org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java: > 79) > at > org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java: > 344) > at > org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java: > 179) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) > at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) > at java.lang.reflect.Method.invoke(Unknown Source) > at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622) > at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577) > at org.eclipse.equinox.launcher.Main.run(Main.java:1410) > at org.eclipse.equinox.launcher.Main.main(Main.java:1386) > > It seems that OSGi doesn't like Guice or vice versa. Has anyone else > come across this issue? > > Regards, > Martin > > -- > 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. > > -- 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.
