Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop and start a bundle that exports a service that is imported multiple() in another bundle barfs... #63

Open
mcculls opened this issue Jun 22, 2015 · 5 comments

Comments

@mcculls
Copy link
Member

mcculls commented Jun 22, 2015

Originally reported on Google Code with ID 60

I have a bundle A that imports multiple() a service S. I have one bundle B that exports
service S. I start felix using mvn pax:run and all bundles start without any issues.
I then stop the bundle B and start it again. This is what I got:

ERROR: Bundle org.ops4j.peaberry.extensions.peaberry.activation [13] EventDispatcher:
Error during dispatch. (java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl)
g! java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
    at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
    at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:76)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.ops4j.peaberry.internal.ServiceProxyFactory.buildProxy(ServiceProxyFactory.java:102)
    at org.ops4j.peaberry.internal.ServiceProxyFactory.serviceProxy(ServiceProxyFactory.java:94)
    at org.ops4j.peaberry.internal.SingleServiceProvider.get(SingleServiceProvider.java:50)
    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.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    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.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
    at org.ops4j.peaberry.internal.Setting$2.get(Setting.java:79)
    at org.ops4j.peaberry.internal.ServiceSettings.getExport(ServiceSettings.java:171)
    at org.ops4j.peaberry.internal.ExportedServiceProvider.get(ExportedServiceProvider.java:46)
    at org.ops4j.peaberry.internal.ExportedServiceProvider.get(ExportedServiceProvider.java:32)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
    at org.ops4j.peaberry.activation.internal.InstanceBundleRoot.activate(InstanceBundleRoot.java:45)
    at org.ops4j.peaberry.activation.internal.BundleActivation.activate(BundleActivation.java:178)
    at org.ops4j.peaberry.activation.internal.BundleActivation.update(BundleActivation.java:156)
    at org.ops4j.peaberry.activation.internal.StateBundleActivationTracker.start(StateBundleActivationTracker.java:38)
    at org.ops4j.peaberry.activation.internal.BundleActivation.start(BundleActivation.java:136)
    at org.ops4j.peaberry.activation.internal.BundleTracker.start(BundleTracker.java:103)
    at org.ops4j.peaberry.activation.internal.BundleTracker.bundleChanged(BundleTracker.java:82)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3883)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1797)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:927)
    at org.apache.felix.gogo.command.Basic.start(Basic.java:758)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
    at org.apache.felix.gogo.shell.Console.run(Console.java:62)
    at org.apache.felix.gogo.shell.Shell.console(Shell.java:203)
    at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
    at org.apache.felix.[FelixDispatchQueue] DEBUG org.ops4j.peaberry.extensions.peaberry.activation
- FrameworkEvent ERROR
java.lang.NoClassDefFoundError: sun/reflect/ConstructorAccessorImpl
    at sun.misc.Unsafe.defineClass(Native Method)
    at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:45)
    at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:381)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:377)
    at sun.reflect.MethodAccessorGenerator.generateConstructor(MethodAccessorGenerator.java:76)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:30)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at org.ops4j.peaberry.internal.ServiceProxyFactory.buildProxy(ServiceProxyFactory.java:102)
    at org.ops4j.peaberry.internal.ServiceProxyFactory.serviceProxy(ServiceProxyFactory.java:94)
    at org.ops4j.peaberry.internal.SingleServiceProvider.get(SingleServiceProvider.java:50)
    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.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    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.ConstructorInjector.construct(ConstructorInjector.java:84)
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
    at com.google.inject.Scopes$1$1.get(Scopes.java:65)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
    at org.ops4j.peaberry.internal.Setting$2.get(Setting.java:79)
    at org.ops4j.peaberry.internal.ServiceSettings.getExport(ServiceSettings.java:171)
    at org.ops4j.peaberry.internal.ExportedServiceProvider.get(ExportedServiceProvider.java:46)
    at org.ops4j.peaberry.internal.ExportedServiceProvider.get(ExportedServiceProvider.java:32)
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978)
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024)
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974)
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009)
    at org.ops4j.peaberry.activation.internal.InstanceBundleRoot.activate(InstanceBundleRoot.java:45)
    at org.ops4j.peaberry.activation.internal.BundleActivation.activate(BundleActivation.java:178)
    at org.ops4j.peaberry.activation.internal.BundleActivation.update(BundleActivation.java:156)
    at org.ops4j.peaberry.activation.internal.StateBundleActivationTracker.start(StateBundleActivationTracker.java:38)
    at org.ops4j.peaberry.activation.internal.BundleActivation.start(BundleActivation.java:136)
    at org.ops4j.peaberry.activation.internal.BundleTracker.start(BundleTracker.java:103)
    at org.ops4j.peaberry.activation.internal.BundleTracker.bundleChanged(BundleTracker.java:82)
    at org.apache.felix.framework.util.EventDispatcher.invokeBundleListenerCallback(EventDispatcher.java:807)
    at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:729)
    at org.apache.felix.framework.util.EventDispatcher.fireBundleEvent(EventDispatcher.java:610)
    at org.apache.felix.framework.Felix.fireBundleEvent(Felix.java:3883)
    at org.apache.felix.framework.Felix.startBundle(Felix.java:1797)
    at org.apache.felix.framework.BundleImpl.start(BundleImpl.java:927)
    at org.apache.felix.gogo.command.Basic.start(Basic.java:758)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
    at org.apache.felix.gogo.shell.Console.run(Console.java:62)
    at org.apache.felix.gogo.shell.Shell.console(Shell.java:203)
    at org.apache.felix.gogo.shell.Shell.gosh(Shell.java:128)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.felix.gogo.runtime.Reflective.method(Reflective.java:136)
    at org.apache.felix.gogo.runtime.CommandProxy.execute(CommandProxy.java:82)
    at org.apache.felix.gogo.runtime.Closure.executeCmd(Closure.java:469)
    at org.apache.felix.gogo.runtime.Closure.executeStatement(Closure.java:395)
    at org.apache.felix.gogo.runtime.Pipe.run(Pipe.java:108)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:183)
    at org.apache.felix.gogo.runtime.Closure.execute(Closure.java:120)
    at org.apache.felix.gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
    at org.apache.felix.gogo.shell.Activator.run(Activator.java:75)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: sun.reflect.ConstructorAccessorImpl
    at org.ops4j.peaberry.internal.ImportProxyClassLoader.findClass(ImportProxyClassLoader.java:147)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at org.ops4j.peaberry.internal.ImportProxyClassLoader.loadClass(ImportProxyClassLoader.java:131)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 88 more
[FelixDispatchQueue] DEBUG a.b.c - BundleEvent STARTED
gogo.runtime.CommandSessionImpl.execute(CommandSessionImpl.java:89)
    at org.apache.felix.gogo.shell.Activator.run(Activator.java:75)
    at java.lang.Thread.run(Thread.java:680)
Caused by: java.lang.ClassNotFoundException: sun.reflect.ConstructorAccessorImpl
    at org.ops4j.peaberry.internal.ImportProxyClassLoader.findClass(ImportProxyClassLoader.java:147)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at org.ops4j.peaberry.internal.ImportProxyClassLoader.loadClass(ImportProxyClassLoader.java:131)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    ... 88 more

Reported by ydewit on 2011-04-15 07:10:37

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Seems like I am not the first one... See here (http://code.google.com/p/google-guice/issues/detail?id=417)
and here (http://code.google.com/p/google-guice/issues/detail?id=343). 

However, the last link seems to suggest that since Guice 2.1 there shouldnt be a need
to muck with the org.osgi.framework.bootdelegation. Is this issue alive again?

Reported by ydewit on 2011-04-16 01:09:15

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Add <param>--bootDelegation=javax.*,com.sun.*,sun.*</param> and it works.

Reported by ydewit on 2011-04-16 05:42:20

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

While you won't need to mess around with "org.osgi.framework.bootdelegation" for recent
builds of Guice, it will still be an issue for the proxy generated by Peaberry (would
require a patch to ImportProxyClassLoader to funnel any sun.reflect.* requests to the
bootstrap classloader, rather than delegating to the OSGi classloader which may not
have access to sun.reflect.*).

Reported by mcculls on 2011-04-17 21:04:30

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Reported by mcculls on 2012-08-04 21:19:36

  • Status changed: Accepted

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

Reported by mcculls on 2012-08-04 21:48:52

  • Labels added: Peaberry-Core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant