google-code-export / google-guice

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

BridgeClassLoader is not aware of: java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl #417

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I've just reached a threshhold of services in my project that triggers the 
following jvm bug:

        http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6265952

My Environment is Mac OS X, java 1.6.0_13 and I'm running guice inside felix 
(see 
felix.apache.org).

As soon as I create my Injector I get following stacktrace:

com.google.inject.internal.ComputationException: 
java.lang.NoClassDefFoundError: 
sun/reflect/ConstructorAccessorImpl
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:553)
    at com.google.inject.internal.MapMaker$StrategyImpl.compute(MapMaker.java:419)
    at 
com.google.inject.internal.CustomConcurrentHashMap$ComputingImpl.get(CustomConcu
rrentH
ashMap.java:2041)
    at com.google.inject.internal.FailableCache.get(FailableCache.java:46)
    at com.google.inject.ConstructorInjectorStore.get(ConstructorInjectorStore.java:52)
    at com.google.inject.ConstructorBindingImpl.initialize(ConstructorBindingImpl.java:57)
    at com.google.inject.InjectorImpl.initializeBinding(InjectorImpl.java:377)
    at com.google.inject.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:645)
    at com.google.inject.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:581)
    at com.google.inject.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:172)
    at com.google.inject.InjectorImpl.getBindingOrThrow(InjectorImpl.java:132)
    at com.google.inject.InjectorImpl.getInternalFactory(InjectorImpl.java:651)
    at com.google.inject.FactoryProxy.notify(FactoryProxy.java:48)
    at com.google.inject.BindingProcessor.runCreationListeners(BindingProcessor.java:230)
    at com.google.inject.InjectorBuilder.initializeStatically(InjectorBuilder.java:131)
    at com.google.inject.InjectorBuilder.build(InjectorBuilder.java:105)
    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.tryge.negret.features.admin.Activator.start(Activator.java:45)
    at org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:589)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1458)
    at org.apache.felix.framework.Felix.setActiveStartLevel(Felix.java:984)
    at org.apache.felix.framework.StartLevelImpl.run(StartLevelImpl.java:263)
    at java.lang.Thread.run(Thread.java:637)

As the corresponding jvm bug shows the option: -Dsun.reflect.noInflation=true 
makes the bug 
reproducable.

It may or may not be a concern of guice to fix this issue, however for my 
project the only 
alternative is to fix the BridgeClassLoader of Guice ...

Original issue reported on code.google.com by michael....@googlemail.com on 19 Aug 2009 at 1:14

GoogleCodeExporter commented 9 years ago
After looking into the BridgeClassLoader I've found the problem was in the 
configuraiton of felix's class loader.

No issue for guice :)

Original comment by michael....@googlemail.com on 19 Aug 2009 at 1:56

GoogleCodeExporter commented 9 years ago
Hi Michael,
I using Guice running in felix and have the same issue with yours, may i know 
what
the solution and the setting for the felix? 
thanks

Original comment by hendra.t...@gmail.com on 25 Aug 2009 at 9:37

GoogleCodeExporter commented 9 years ago
Hi,

you have to set following property in the felix configuration file:

org.osgi.framework.bootdelegation=sun.*,com.sun.*

then the classes are found correctly.

Best regards,
Michael

Original comment by michael....@googlemail.com on 25 Aug 2009 at 12:01

GoogleCodeExporter commented 9 years ago
Hi,
its works!!, thanks michael.

Original comment by hendra.t...@gmail.com on 26 Aug 2009 at 1:28

GoogleCodeExporter commented 9 years ago
Actually there is a way that we can work round this in our bridge classloader 
which
would avoid you having to mess around with the framework's bootdelegation 
property.

Will attach a patch later on that builds on my newly reworked patch for issue 
#343.

Original comment by mccu...@gmail.com on 31 Oct 2009 at 4:00

GoogleCodeExporter commented 9 years ago

Original comment by mccu...@gmail.com on 31 Oct 2009 at 4:01

GoogleCodeExporter commented 9 years ago
The latest patch in issue 343 (date 20091102) removes the need to alter
bootdelegation settings. It automatically delegates requests for 
"sun.reflect..." to
the right class loader.

Original comment by mccu...@gmail.com on 2 Nov 2009 at 8:13

GoogleCodeExporter commented 9 years ago
Hi

I'm getting the following error when starting the Server (Websphere 7).

Caused by: com.google.inject.internal.ComputationException: 
java.lang.NoClassDefFound: Configuration
at com.google.inject.internal.MapMarker$StartgyImpl.compute(MapMarker:553)

Can someone plese help me with this...

Thanks in advance...

Original comment by sridha...@gmail.com on 21 Feb 2010 at 4:31

GoogleCodeExporter commented 9 years ago
Have you tried the latest patched jar attached to issue 343?

http://google-guice.googlecode.com/issues/attachment?aid=260860873986359775&name
=guice-customloader-20100218.jar

Original comment by mccu...@gmail.com on 21 Feb 2010 at 4:43

GoogleCodeExporter commented 9 years ago

Original comment by sberlin on 19 Apr 2010 at 2:36