[arquillian-issues] [JBoss JIRA] (ARQ-1943) Deployment fails with WELD >= 2.2.5.Final because of duplicate CDI beans when deployment contains bean archive

Chris Rankin (JIRA) issues at jboss.org
Mon Apr 20 09:46:18 EDT 2015


    [ https://issues.jboss.org/browse/ARQ-1943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13060634#comment-13060634 ] 

Chris Rankin commented on ARQ-1943:
-----------------------------------

[The plot thickens|https://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#_bean_archive_isolation]:
{quote}In general, an implicit bean archive does not have to contain a beans.xml descriptor. However, such a bean archive is not supported by Weld Servlet, i.e. it’s excluded from discovery.{quote}

My Tomcat is indeed using Weld Servlet, which means my bean archive _must_ contain a {{beans.xml}} descriptor. And toggling the {{org.jboss.weld.environment.servlet.archive.isolation}} context parameter has the following effect:

|| {{org.jboss.weld.environment.servlet.archive.isolation}} || Bean instances ||
| true | 2 |
| false | 0 |


> Deployment fails with WELD >= 2.2.5.Final because of duplicate CDI beans when deployment contains bean archive
> --------------------------------------------------------------------------------------------------------------
>
>                 Key: ARQ-1943
>                 URL: https://issues.jboss.org/browse/ARQ-1943
>             Project: Arquillian
>          Issue Type: Bug
>          Components: Tomcat Containers
>    Affects Versions: tomcat_1.0.0.CR7
>         Environment: Windows 7 x64, Linux x64, JDK7
>            Reporter: Chris Rankin
>         Attachments: arquillian-test.tar.xz, arquillian-test.tar.xz
>
>
> Using arquillian-tomcat-embedded-7, arquillian-bom 1.1.7.Final, WELD 2.2.10.Final:
> I have created a simple WAR file that contains WELD and a single servlet. There is also a dependent JAR that contains the following:
> - a @Dependent bean with a @Produces method
> - a META-INF/beans.xml file.
> When I try to test this servlet using Arquillian's TestNG container, the deployment fails with this error:
> SEVERE: Servlet  threw load() exception
> org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type String with qualifiers @Trouble
>   at injection point [BackedAnnotatedField] @Trouble @Inject private org.testing.web.TroubleServlet.trouble
>   at org.testing.web.TroubleServlet.trouble(TroubleServlet.java:0)
>   Possible dependencies: 
>   - Producer Method [String] with qualifiers [@Trouble @Any] declared as [[BackedAnnotatedMethod] @Produces @Trouble org.testing.TroubleMaker.getTrouble()],
>   - Producer Method [String] with qualifiers [@Trouble @Any] declared as [[BackedAnnotatedMethod] @Produces @Trouble org.testing.TroubleMaker.getTrouble()]



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)



More information about the arquillian-issues mailing list