[ 
https://issues.apache.org/jira/browse/DELTASPIKE-643?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14031831#comment-14031831
 ] 

Gerhard Petracek commented on DELTASPIKE-643:
---------------------------------------------

weld is inconsistent here and jersey is using an approach which isn't portable 
at all (i implemented the cdi integration for wink2 and therefore i know that 
it's possible to implement it in a portable manner...)

jersey calls a veto on the original beans (in 
CdiComponentProvider#processAnnotatedType), but with your setup weld doesn't 
expose the original beans to the extension -> you could try to report a jersey 
and/or weld issue.

weld issue due to:

if you use
{code}
@Inject
private Instance<BoundRequestContext> boundRequestContextInstance;
{code}

boundRequestContextInstance#isAmbiguous returns false, but 

{code}
@Inject
private BoundRequestContext boundRequestContext;
{code}

leads to the deployment exception, you see.

workaround:
-> you could implement your own cdictrl-weld module which uses 
javax.enterprise.inject.Instance.
if we would do it directly, we would give up a deployment check for all the 
valid constellations and we might get issues with different versions of weld.

> Ambiguous dependencies for type BoundRequestContext when weld context 
> controller  under WELD, Jersey, and Tomcat
> ----------------------------------------------------------------------------------------------------------------
>
>                 Key: DELTASPIKE-643
>                 URL: https://issues.apache.org/jira/browse/DELTASPIKE-643
>             Project: DeltaSpike
>          Issue Type: Bug
>          Components: CdiControl
>    Affects Versions: 0.7
>         Environment: Apache Jersey 2.9, WELD  2.1.2, 
>            Reporter: jason zhang
>            Priority: Critical
>
> My server is tomcat 7x, WELD 2.1.2 for CDI, To support CDI injection for 
> Jersey Resource class, I added jersey-gf-cdi. Once jersey-gf-cdi is added, I 
> can not use weld context controller anymore. 
> I got this error
> {code}
> org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous 
> dependencies for type BoundRequestContext with qualifiers @Default
>   at injection point [BackedAnnotatedField] @Inject private 
> org.apache.deltaspike.cdise.weld.ContextController.requestContext
>   at 
> org.apache.deltaspike.cdise.weld.ContextController.requestContext(ContextController.java:0)
>   Possible dependencies: 
>   - WELD%AbstractSyntheticBean%flat%BoundRequestContext,
>   - org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider$Hk2Bean@1af9196
>       at 
> org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:378)
>       at 
> org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:291)
>       at 
> org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:134)
>       at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:165)
>       at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:529)
>       at 
> org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
>       at 
> org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
>       at 
> org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
> {code}
> I have a very simple maven project to reproduce this: 
> https://github.com/jasonzhang2022/cidctrl
> This error also occurs for Deltaspike 05, and 0.6.
> Thanks



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to