You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@aries.apache.org by "Timothy Ward (Updated) (JIRA)" <ji...@apache.org> on 2012/02/02 10:39:54 UTC

[jira] [Updated] (ARIES-703) JDKProxyManager cannot proxy blueprint beans

     [ https://issues.apache.org/jira/browse/ARIES-703?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Timothy Ward updated ARIES-703:
-------------------------------

    Component/s:     (was: Proxy)
                 Blueprint

Moving this to the blueprint component (where the problem actually is. The proxy component is just doing what it's asked.

It might be a good idea to change the blueprint internals a little such that if the blueprint bean needs to be proxied it is always proxied with the minimal set of interfaces/hierarchy that it needs for that particular call (e.g. injecting into another bean via interface or super-class). This would prevent the "one shot" approach we have now where to proxy beans we have to proxy everything, even if the bean is only referred to by interface in the other beans.
                
> JDKProxyManager cannot proxy blueprint beans
> --------------------------------------------
>
>                 Key: ARIES-703
>                 URL: https://issues.apache.org/jira/browse/ARIES-703
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>         Environment: Glassfish 3.1
>            Reporter: Balazs Zsoldos
>
> When there is no ASM between the bundles and aries proxy is installed the default proxy manager is JDKProxyManager. When there is a bean in a blueprint fragment that has for example tx:transaction inside creating the transactional proxy fails with the following stacktrace:
> [#|2011-07-06T14:29:24.542+0200|SEVERE|glassfish3.1|org.apache.aries.blueprint.container.BlueprintContainerImpl|_ThreadID=27;_ThreadName=Thread-1;|Unable to start blueprint container for bundle biz.everit.audit.persistence.biz.everit.audit.persistence.impl
> org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to create proxy for bean eventPersistenceImpl in bundle biz.everit.audit.persistence.biz.everit.audit.persistence.impl version 0.1.0.SNAPSHOT
> 	at org.apache.aries.blueprint.container.BeanRecipe.addInterceptors(BeanRecipe.java:695)
> 	at org.apache.aries.blueprint.container.BeanRecipe.internalCreate(BeanRecipe.java:730)
> 	at org.apache.aries.blueprint.di.AbstractRecipe$1.call(AbstractRecipe.java:71)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:79)
> 	at org.apache.aries.blueprint.di.RefRecipe.internalCreate(RefRecipe.java:60)
> 	at org.apache.aries.blueprint.di.AbstractRecipe.create(AbstractRecipe.java:98)
> 	at org.apache.aries.blueprint.container.BlueprintRepository.createInstances(BlueprintRepository.java:220)
> 	at org.apache.aries.blueprint.container.BlueprintRepository.createInstance(BlueprintRepository.java:205)
> 	at org.apache.aries.blueprint.container.BlueprintRepository.create(BlueprintRepository.java:144)
> 	at org.apache.aries.blueprint.container.ServiceRecipe.createRecipe(ServiceRecipe.java:398)
> 	at org.apache.aries.blueprint.container.ServiceRecipe.createService(ServiceRecipe.java:271)
> 	at org.apache.aries.blueprint.container.ServiceRecipe.internalGetService(ServiceRecipe.java:243)
> 	at org.apache.aries.blueprint.container.ServiceRecipe.getService(ServiceRecipe.java:320)
> 	at org.apache.aries.blueprint.container.ServiceRecipe$TriggerServiceFactory.getService(ServiceRecipe.java:465)
> 	at org.apache.felix.framework.ServiceRegistrationImpl.getFactoryUnchecked(ServiceRegistrationImpl.java:310)
> 	at org.apache.felix.framework.ServiceRegistrationImpl.getService(ServiceRegistrationImpl.java:221)
> 	at org.apache.felix.framework.ServiceRegistry.getService(ServiceRegistry.java:297)
> 	at org.apache.felix.framework.Felix.getService(Felix.java:3014)
> 	at org.apache.felix.framework.BundleContextImpl.getService(BundleContextImpl.java:329)
> 	at org.jvnet.hk2.osgiadapter.HK2Main$HK2ServiceTrackerCustomizer.addingService(HK2Main.java:260)
> 	at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:896)
> 	at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:261)
> 	at org.osgi.util.tracker.AbstractTracked.track(AbstractTracked.java:233)
> 	at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:840)
> 	at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:871)
> 	at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:733)
> 	at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:662)
> 	at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3769)
> 	at org.apache.felix.framework.Felix.access$000(Felix.java:80)
> 	at org.apache.felix.framework.Felix$2.serviceChanged(Felix.java:722)
> 	at org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:107)
> 	at org.apache.felix.framework.Felix.registerService(Felix.java:2854)
> 	at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:251)
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.registerService(BlueprintContainerImpl.java:408)
> 	at org.apache.aries.blueprint.container.ServiceRecipe.register(ServiceRecipe.java:187)
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.registerServices(BlueprintContainerImpl.java:666)
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.doRun(BlueprintContainerImpl.java:334)
> 	at org.apache.aries.blueprint.container.BlueprintContainerImpl.run(BlueprintContainerImpl.java:230)
> 	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
> 	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
> 	at java.util.concurrent.FutureTask.run(FutureTask.java:138)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
> 	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
> 	at java.lang.Thread.run(Thread.java:662)
> Caused by: org.apache.aries.proxy.UnableToProxyException: The class biz.everit.audit.persistence.impl.EventPersistenceServiceImpl is not an interface and therefore a proxy cannot be generated.
> 	at org.apache.aries.proxy.impl.JdkProxyManager.getInterfaces(JdkProxyManager.java:43)
> 	at org.apache.aries.proxy.impl.JdkProxyManager.createNewProxy(JdkProxyManager.java:36)
> 	at org.apache.aries.proxy.impl.AbstractProxyManager.createDelegatingInterceptingProxy(AbstractProxyManager.java:75)
> 	at org.apache.aries.proxy.impl.AbstractProxyManager.createInterceptingProxy(AbstractProxyManager.java:53)
> 	at org.apache.aries.blueprint.container.BeanRecipe.addInterceptors(BeanRecipe.java:690)
> 	... 47 more
> It will always happen as we have the following line in BeanRecepe:
> intercepted = BlueprintExtender.getProxyManager().createInterceptingProxy(b, 
>                   ProxyUtils.asList(original.getClass()), original, 
>                   new Collaborator(interceptorLookupKey, interceptors));
> That means that the interface list is the class of the bean itself that is cannot be an interface. In case of JDKProxy we should derive the interfaces that the bean implements and those interface classes should be passed. However at this level (BeanRecipe) we do not know about the proxy manager...
> The example blueprint file for this:
> <bean id="eventPersistenceImpl" class="biz.everit.audit.persistence.impl.EventPersistenceServiceImpl">
> 		<tx:transaction method="*" value="Required" />
> 		<jpa:context property="em" unitname="biz.everit.audit.persistence.entity" type="TRANSACTION" />
> </bean>

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira