Why CDI deployment throws WELD-001414 Bean name is ambiguous exception EAP 6 ?

Solution Verified - Updated -

Issue

  • Deploying an ear with one ejb and two war modules. In each war module are one cdi bean in different packages but with the same bean name. During the deployment getting the following Exception:
ERROR [org.jboss.msc.service.fail] (MSC service thread 1-5) MSC000001: Failed to start service jboss.deployment.unit."jboss-ejb-in-ear.ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."jboss-ejb-in-ear.ear".WeldStartService: Failed to start service
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_65]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_65]
    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_65]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name greeter resolves to beans [Managed Bean [class org.jboss.as.quickstarts.ear.controller2.Greeter] with qualifiers [@Any @Default @Named], Managed Bean [class org.jboss.as.quickstarts.ear.controller2.Greeter] with qualifiers [@Any @Default @Named]]
    at org.jboss.weld.bootstrap.Validator.validateBeanNames(Validator.java:476)
    at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:373)
    at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:379)
    at org.jboss.as.weld.WeldStartService.start(WeldStartService.java:64)
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA-redhat-1.jar:1.0.4.GA-redhat-1]
    ... 3 more

ERROR [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "jboss-ejb-in-ear.ear" was rolled back with the following failure message:
{"JBAS014671: Failed services" => {"jboss.deployment.unit.\"jboss-ejb-in-ear.ear\".WeldStartService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"jboss-ejb-in-ear.ear\".WeldStartService: Failed to start service
    Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name greeter resolves to beans [Managed Bean [class org.jboss.as.quickstarts.ear.controller2.Greeter] with qualifiers [@Any @Default @Named], Managed Bean [class org.jboss.as.quickstarts.ear.controller2.Greeter] with qualifiers [@Any @Default @Named]]"}}

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6.1.x
    • 6.2.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content