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

UnsupportedOperationException when used in JBOSS #76

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

UnsupportedOperationException when used in JBOSS #76

mcculls opened this issue Jun 22, 2015 · 2 comments

Comments

@mcculls
Copy link
Member

mcculls commented Jun 22, 2015

Originally reported on Google Code with ID 73

I'm trying to consume existing OSGi service from GWT webapp deployed as WAR in JBOSS
AS7.1.

BundleContext is injected using @Resource. I can get hold of a service 
directly from bundleContext but when trying to get it injected using peaberry it fails
with UnsupportedOperationException.

1 error
    at com.google.inject.internal.Errors.throwCreationExceptionIfErrorsExist(Errors.java:435)
[Errors.class:]
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:175)
[InternalInjectorCreator.class:]
    at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:109)
[InternalInjectorCreator.class:]
    at com.google.inject.Guice.createInjector(Guice.java:95) [Guice.class:]
    at com.google.inject.Guice.createInjector(Guice.java:72) [Guice.class:]
    at com.google.inject.Guice.createInjector(Guice.java:62) [Guice.class:]
    at com.jjaannrr.objectmanager.webapp.server.ObjectManagerGuiceServletConfig.getInjector(ObjectManagerGuiceServletConfig.java:44)
[classes:]
    at com.google.inject.servlet.GuiceServletContextListener.contextInitialized(GuiceServletContextListener.java:45)
[guice-servlet-3.0.jar:]
    at org.apache.catalina.core.StandardContext.contextListenerStart(StandardContext.java:3392)
[jbossweb-7.0.13.Final.jar:]
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3850) [jbossweb-7.0.13.Final.jar:]
    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:90)
[jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
[rt.jar:1.6.0_24]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
[rt.jar:1.6.0_24]
    at java.lang.Thread.run(Thread.java:662) [rt.jar:1.6.0_24]
Caused by: java.lang.UnsupportedOperationException
    at org.ops4j.peaberry.osgi.AttributeDictionary.put(AttributeDictionary.java:67) [peaberry-1.2.jar:]
    at org.ops4j.peaberry.osgi.AttributeDictionary.put(AttributeDictionary.java:30) [peaberry-1.2.jar:]
    at org.jboss.osgi.framework.internal.ServiceState.<init>(ServiceState.java:109)
    at org.jboss.osgi.framework.internal.ServiceManagerPlugin.registerService(ServiceManagerPlugin.java:161)
    at org.jboss.osgi.framework.internal.AbstractBundleContext.registerService(AbstractBundleContext.java:301)
    at org.jboss.osgi.framework.internal.AbstractBundleContext.registerService(AbstractBundleContext.java:293)
    at org.ops4j.peaberry.osgi.BundleScopeImpl$1.get(BundleScopeImpl.java:83) [peaberry-1.2.jar:]
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
[InternalFactoryToProviderAdapter.class:]
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54) [FactoryProxy.class:]
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978) [InjectorImpl$4$1.class:]
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) [InjectorImpl.class:]
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974) [InjectorImpl$4.class:]
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1009) [InjectorImpl.class:]
    at org.ops4j.peaberry.internal.Setting$2.get(Setting.java:79) [peaberry-1.2.jar:]
    at org.ops4j.peaberry.internal.ServiceSettings.getImports(ServiceSettings.java:140)
[peaberry-1.2.jar:]
    at org.ops4j.peaberry.internal.SingleServiceProvider$DirectProvider.get(SingleServiceProvider.java:67)
[peaberry-1.2.jar:]
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
[InternalFactoryToProviderAdapter.class:]
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
[SingleParameterInjector.class:]
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
[SingleParameterInjector.class:]
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
[ConstructorInjector.class:]
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
[ConstructorBindingImpl$Factory.class:]
    at com.google.inject.internal.FactoryProxy.get(FactoryProxy.java:54) [FactoryProxy.class:]
    at com.google.inject.internal.ProviderToInternalFactoryAdapter$1.call(ProviderToInternalFactoryAdapter.java:46)
[ProviderToInternalFactoryAdapter$1.class:]
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) [InjectorImpl.class:]
    at com.google.inject.internal.ProviderToInternalFactoryAdapter.get(ProviderToInternalFactoryAdapter.java:40)
[ProviderToInternalFactoryAdapter.class:]
    at com.google.inject.Scopes$1$1.get(Scopes.java:65) [Scopes$1$1.class:]
    at com.google.inject.internal.InternalFactoryToProviderAdapter.get(InternalFactoryToProviderAdapter.java:40)
[InternalFactoryToProviderAdapter.class:]
    at com.google.inject.internal.SingleParameterInjector.inject(SingleParameterInjector.java:38)
[SingleParameterInjector.class:]
    at com.google.inject.internal.SingleParameterInjector.getAll(SingleParameterInjector.java:62)
[SingleParameterInjector.class:]
    at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:84)
[ConstructorInjector.class:]
    at com.google.inject.internal.ConstructorBindingImpl$Factory.get(ConstructorBindingImpl.java:254)
[ConstructorBindingImpl$Factory.class:]
    at com.google.inject.internal.InjectorImpl$4$1.call(InjectorImpl.java:978) [InjectorImpl$4$1.class:]
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1031) [InjectorImpl.class:]
    at com.google.inject.internal.InjectorImpl$4.get(InjectorImpl.java:974) [InjectorImpl$4.class:]
    at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1013) [InjectorImpl.class:]
    at net.customware.gwt.dispatch.server.guice.ActionHandlerLinker.linkHandlers(ActionHandlerLinker.java:39)
[gwt-dispatch-1.2.0.jar:]
    at net.customware.gwt.dispatch.server.guice.ActionHandlerLinker$$FastClassByGuice$$5cebd19a.invoke(<generated>)
    at com.google.inject.internal.cglib.reflect.$FastMethod.invoke(FastMethod.java:53)
[$FastMethod.class:]
    at com.google.inject.internal.SingleMethodInjector$1.invoke(SingleMethodInjector.java:56)
[SingleMethodInjector$1.class:]
    at com.google.inject.internal.SingleMethodInjector.inject(SingleMethodInjector.java:90)
[SingleMethodInjector.class:]
    at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:116)
[InjectionRequestProcessor$StaticInjection$1.class:]
    at com.google.inject.internal.InjectionRequestProcessor$StaticInjection$1.call(InjectionRequestProcessor.java:110)
[InjectionRequestProcessor$StaticInjection$1.class:]
    at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1024) [InjectorImpl.class:]
    at com.google.inject.internal.InjectionRequestProcessor$StaticInjection.injectMembers(InjectionRequestProcessor.java:110)
[InjectionRequestProcessor$StaticInjection.class:]
    at com.google.inject.internal.InjectionRequestProcessor.injectMembers(InjectionRequestProcessor.java:78)
[InjectionRequestProcessor.class:]
    at com.google.inject.internal.InternalInjectorCreator.injectDynamically(InternalInjectorCreator.java:170)
[InternalInjectorCreator.class:]
    ... 14 more


What version of the product are you using? On what operating system?
peaberry 1.2, Windows XP, JBOSS AS 7.1.1

Please provide any additional information below.

Reported by jjaannrr on 2012-04-24 10:14:27

@mcculls
Copy link
Member Author

mcculls commented Jun 22, 2015

It appears that JBoss doesn't take a defensive copy of the service properties on registerService,
unlike other frameworks. We can work around this by cloning/copying the defined properties
into a mutable collection.

Reported by mcculls on 2012-08-04 21:24:37

  • 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