[
https://issues.apache.org/jira/browse/DELTASPIKE-1060?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15083211#comment-15083211
]
Martin Kouba commented on DELTASPIKE-1060:
------------------------------------------
At first glance, I think this cannot work. An interceptor is a dependent
instance of the object it intercepts. But here the
{{org.apache.deltaspike.proxy.impl.invocation.ManualInvocationContext}}
instatiates a new interceptor instance with a new {{CreationalContext}}. In
other words, there is no way to identify the {{@Intercepted}} bean - there is
no link to the object it intercepts.
> @Intercepted does not work with partial bean proxy
> --------------------------------------------------
>
> Key: DELTASPIKE-1060
> URL: https://issues.apache.org/jira/browse/DELTASPIKE-1060
> Project: DeltaSpike
> Issue Type: Bug
> Components: Proxy-Module
> Affects Versions: 1.5.2
> Reporter: Harald Wellmann
> Assignee: Thomas Andraschko
> Priority: Minor
> Attachments: deltaspike1060.tgz
>
>
> For a partial bean with an interceptor binding and an interceptor which
> injects the intercepted bean, e.g.
> {code}
> @Inject
> @Intercepted
> private Bean<?> intercepted;
> {code}
> Weld 2.2+ throws the following exception when an intercepted method of the
> partial bean is invoked:
> {noformat}
> Caused by: org.jboss.weld.exceptions.IllegalArgumentException: WELD-001549:
> Unable to determine parent creational context of
> org.jboss.weld.context.CreationalContextImpl@4841524b
> at
> org.jboss.weld.bean.builtin.AbstractBuiltInMetadataBean.getParentCreationalContext(AbstractBuiltInMetadataBean.java:65)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.builtin.InterceptedBeanMetadataBean.newInstance(InterceptedBeanMetadataBean.java:62)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.builtin.InterceptedBeanMetadataBean.newInstance(InterceptedBeanMetadataBean.java:47)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.builtin.AbstractBuiltInMetadataBean.create(AbstractBuiltInMetadataBean.java:53)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:69)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.ContextualInstanceStrategy$DefaultContextualInstanceStrategy.get(ContextualInstanceStrategy.java:101)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.bean.ContextualInstance.get(ContextualInstance.java:50)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:761)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.manager.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:861)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:92)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:375)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:386)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.producer.ResourceInjector$1.proceed(ResourceInjector.java:70)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.producer.ResourceInjector.inject(ResourceInjector.java:72)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.jboss.weld.injection.producer.BasicInjectionTarget.inject(BasicInjectionTarget.java:121)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at org.jboss.weld.bean.ManagedBean.create(ManagedBean.java:159)
> [weld-core-impl-2.2.14.Final.jar:2015-06-24 15:18]
> at
> org.apache.deltaspike.proxy.impl.invocation.ManualInvocationContext.proceed(ManualInvocationContext.java:84)
> at
> org.apache.deltaspike.proxy.impl.invocation.AbstractManualInvocationHandler.invoke(AbstractManualInvocationHandler.java:48)
> at
> org.apache.deltaspike.proxy.impl.invocation.DelegateManualInvocationHandler.staticInvoke(DelegateManualInvocationHandler.java:39)
> at demo.CustomerDao$$DSPartialBeanProxy.findBy(Unknown Source)
> {noformat}
> The problem was discovered trying to port an application from WildFly
> 9.0.1.Final to 10.0.0.CR5. In WildFly 10, the Narayana transactional
> interceptor implementation does inject the intercepted bean, which was not
> the case in WildFly 9.
> The problem can be reproduced also on WildFly 9 with a simple demo
> interceptor. I'll attach a sample project.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)