Deployment of JBPM as a WAR/EAR in JBoss 7 – org.jboss.weld.exceptions.DeploymentException: WELD-001409

The following problem was faced while deploying the jbpm-examples-rewards-jsf application in jboss-as-7.1.1.Final:

11:52:51,134 INFO  [org.jboss.solder.exception.control.extension] (MSC service thread 1-6) Adding handler Qualifiers: [@javax.enterprise.inject.Any()] TraversalMode: BREADTH_FIRST Handles Type: class java.lang.Throwable Precedence: -100 [method] public org.jboss.seam.transaction.SimpleTransactionExceptionHandler.markTransactionRollback(CaughtException) to known handlers
11:52:51,300 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-6) MSC00001: Failed to start service jboss.deployment.unit."rewards-jsf-6.0.1-SNAPSHOT.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."rewards-jsf-6.0.1-SNAPSHOT.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.examples.util.RewardsApplicationScopedProducer.usergroupCallback]. Possible dependencies [[Managed Bean [class org.jbpm.examples.util.RewardsUserGroupCallback] with qualifiers [@Any @Default], Producer Method [UserGroupCallback] with qualifiers [@Any @Default] declared as [[method] @ApplicationScoped @Produces public org.jbpm.kie.services.cdi.producer.DefaultUserGroupInfoProducer.produceCallback()]]]
	at org.jboss.as.weld.services.WeldService.start(WeldService.java:83)
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
	at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [rt.jar:1.6.0_20]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [rt.jar:1.6.0_20]
	at java.lang.Thread.run(Thread.java:619) [rt.jar:1.6.0_20]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.examples.util.RewardsApplicationScopedProducer.usergroupCallback]. Possible dependencies [[Managed Bean [class org.jbpm.examples.util.RewardsUserGroupCallback] with qualifiers [@Any @Default], Producer Method [UserGroupCallback] with qualifiers [@Any @Default] declared as [[method] @ApplicationScoped @Produces public org.jbpm.kie.services.cdi.producer.DefaultUserGroupInfoProducer.produceCallback()]]]
	at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:278)
	at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:244)
	at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:107)
	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:127)
	at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:346)
	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:331)
	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:366)
	at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:83)
	at org.jboss.as.weld.services.WeldService.start(WeldService.java:76)
	... 5 more

11:52:51,318 INFO  [org.jboss.as] (MSC service thread 1-6) JBAS015951: Admin console listening on http://127.0.0.1:9990
11:52:51,319 ERROR [org.jboss.as] (MSC service thread 1-6) JBAS015875: JBoss AS 7.1.1.Final "Brontes" started (with errors) in 13284ms - Started 198 of 311 services (36 services failed or missing dependencies, 76 services are passive or on-demand)
11:52:51,522 INFO  [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS015870: Deploy of deployment "rewards-jsf-6.0.1-SNAPSHOT.war" was rolled back with failure message {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"rewards-jsf-6.0.1-SNAPSHOT.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"rewards-jsf-6.0.1-SNAPSHOT.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.examples.util.RewardsApplicationScopedProducer.usergroupCallback]. Possible dependencies [[Managed Bean [class org.jbpm.examples.util.RewardsUserGroupCallback] with qualifiers [@Any @Default], Producer Method [UserGroupCallback] with qualifiers [@Any @Default] declared as [[method] @ApplicationScoped @Produces public org.jbpm.kie.services.cdi.producer.DefaultUserGroupInfoProducer.produceCallback()]]]"}}
11:52:51,597 INFO  [org.jboss.as.jpa] (MSC service thread 1-2) JBAS011403: Stopping Persistence Unit Service 'rewards-jsf-6.0.1-SNAPSHOT.war#org.jbpm.examples.rewards-jsf'
11:52:51,918 INFO  [org.jboss.as.server.deployment] (MSC service thread 1-8) JBAS015877: Stopped deployment rewards-jsf-6.0.1-SNAPSHOT.war in 396ms
11:52:51,920 INFO  [org.jboss.as.controller] (DeploymentScanner-threads - 2) JBAS014774: Service status report
JBAS014777:   Services which failed to start:      service jboss.deployment.unit."rewards-jsf-6.0.1-SNAPSHOT.war".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."rewards-jsf-6.0.1-SNAPSHOT.war".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.examples.util.RewardsApplicationScopedProducer.usergroupCallback]. Possible dependencies [[Managed Bean [class org.jbpm.examples.util.RewardsUserGroupCallback] with qualifiers [@Any @Default], Producer Method [UserGroupCallback] with qualifiers [@Any @Default] declared as [[method] @ApplicationScoped @Produces public org.jbpm.kie.services.cdi.producer.DefaultUserGroupInfoProducer.produceCallback()]]]

11:52:51,925 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) {"JBAS014653: Composite operation failed and was rolled back. Steps that failed:" => {"Operation step-2" => {"JBAS014671: Failed services" => {"jboss.deployment.unit.\"rewards-jsf-6.0.1-SNAPSHOT.war\".WeldService" => "org.jboss.msc.service.StartException in service jboss.deployment.unit.\"rewards-jsf-6.0.1-SNAPSHOT.war\".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [UserGroupCallback] with qualifiers [@Default] at injection point [[field] @Inject private org.jbpm.examples.util.RewardsApplicationScopedProducer.usergroupCallback]. Possible dependencies [[Managed Bean [class org.jbpm.examples.util.RewardsUserGroupCallback] with qualifiers [@Any @Default], Producer Method [UserGroupCallback] with qualifiers [@Any @Default] declared as [[method] @ApplicationScoped @Produces public org.jbpm.kie.services.cdi.producer.DefaultUserGroupInfoProducer.produceCallback()]]]"}}}}
11:53:16,294 INFO  [org.jboss.as.osgi] (MSC service thread 1-1) JBAS011942: Stopping OSGi Framework
11:53:16,299 INFO  [org.apache.catalina.core.StandardContext] (MSC service thread 1-6) Container org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/] has not been started

These steps help to solve this problem:

  1. Create a CDI qualifier:

    @Qualifier
    @Retention(RetentionPolicy.RUNTIME)
    @Target({ ElementType.TYPE, ElementType.METHOD, ElementType.FIELD, ElementType.PARAMETER })
    public @interface MyGroupQualifier {
    

  2. Annotate class RewardsUserGroupCallback like this:

    @Alternative
    @MyGroupQualifier
    public class RewardsUserGroupCallback implements UserGroupCallback {
    ...
    }
    

  3. Annotate the injection point like this:

    @Inject
    @MyGroupQualifier
    private UserGroupCallback usergroupCallback;
    

Short URL for this post: http://wp.me/p4nxik-2iO
This entry was posted in Java EE, Java Runtimes - VM, Appserver & Cloud and tagged , . Bookmark the permalink.

Leave a Reply