multiple engine-cdi in EAR - WELD-001414 Bean name is ambiguous

1,238 views
Skip to first unread message

Halil

unread,
Jun 29, 2014, 3:44:23 PM6/29/14
to camunda-...@googlegroups.com
Hi together,

i get the following error during deployment of an EAR to camunda-bpm-jboss-7.1.0-final:


21:36:44,525 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."....ear".WeldStartService: org.jboss.msc.service.StartException in service jboss.deployment.unit."....ear".WeldStartService: Failed to start service
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1767) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001414 Bean name is ambiguous. Name businessKey resolves to beans [Producer Method [String] with qualifiers [@Any @BusinessKey @Named] declared as [[method] @Produces @Named @BusinessKey public org.camunda.bpm.engine.cdi.impl.annotation.BusinessKeyProducer.businessKey(ProcessInstance)], Producer Method [String] with qualifiers [@Any @BusinessKey @Named] declared as [[method] @Produces @Named @BusinessKey public org.camunda.bpm.engine.cdi.impl.annotation.BusinessKeyProducer.businessKey(ProcessInstance)]]
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.jar:1.0.4.GA]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1746) [jboss-msc-1.0.4.GA.jar:1.0.4.GA]
... 3 more


Project structure looks as followed:
  • EAR
    • ui.war
      • beans.xml (src/main/webapp/WEB-INF)
      • camunda dependencies
        • engine-cdi
    • process.war
      • beans.xml (src/main/webapp/WEB-INF))
      • camunda dependencies
        • engine
        • engine-cdi
        • ejb-client
    • another-process.war 
      • beans.xml (src/main/webapp/WEB-INF)
      • camunda dependencies
        • engine
        • engine-cdi
        • ejb-client

Thus, engine-cdi dependency exist in each war archive. 
I've tried to solve it with skinny wars, but it cause problems during runtime.

Any idea to solve this problem?

Thanks beforehand.

Best regards.

Daniel Meyer

unread,
Jul 1, 2014, 6:49:07 AM7/1/14
to camunda-...@googlegroups.com
Hi Halil,

AFAIK, you can either 
- isolate the classoaders of the different WARs embedded inside the EAR
- or you can  add the camunda engine cdi jar once to the lib  folder of the EAR and remove it from the WARs.

Does that work?

Cheers,
Daniel

Halil

unread,
Jul 2, 2014, 2:27:38 PM7/2/14
to camunda-...@googlegroups.com
Hi Daniel,

thanks for your hints.

i will try to solve it tomorrow and post a feedback about it here and in jira.

Many thanks.

Best regards

Halil

unread,
Jul 6, 2014, 6:08:54 AM7/6/14
to camunda-...@googlegroups.com
Hi Daniel,

i've solved this problem by moving engine-cdi to the lib folder of the the EAR.

Thanks a lot!

Best regards

Am Dienstag, 1. Juli 2014 12:49:07 UTC+2 schrieb Daniel Meyer:

Mark Struberg

unread,
Jul 6, 2014, 9:18:09 AM7/6/14
to camunda-...@googlegroups.com
I personally think this is likely a bug in JBossAS. 
Actually an @Named bean in a WARs WEB-INF/classes or /lib should only be visible in that very web application. Gerhard Petracek did quite extensive testing in this regard and found that almost all EE server have some glitches with handling EARs. 

In your case it might help to move the camundabpm libs to the shared EAR lib folder. 

If you hit the same problem with your own CDI beans then you can try the latest version from master.
I've already shipped a patch (think it even got applied already) which also enabled CDI for class: attributes. This is in 7.2.0-SNAPSHOT if you like to test it.

LieGrue,
strub

Halil

unread,
Jul 6, 2014, 2:15:48 PM7/6/14
to camunda-...@googlegroups.com
Hi Mark,

sounds great...i will test and comment it in these days.

Best regards
Halil

Halil

unread,
Jul 13, 2014, 7:30:27 AM7/13/14
to camunda-...@googlegroups.com
Hi Mark,

i've checked out the camunda-bpm-jboss-7.2.0-SNAPSHOT from master and get the following error during startup (without any deployment by my side):

13:25:03,801 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 50) MSC00001: Failed to start service org.camunda.bpm.platform.process-engine.default: org.jboss.msc.service.StartException in service org.camunda.bpm.platform.process-engine.default: java.lang.NoClassDefFoundError: org/camunda/bpm/model/bpmn/BpmnModelInstance
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:97) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_60]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_60]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_60]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_60]
at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.0.Final.jar:2.1.0.Final]
Caused by: java.lang.NoClassDefFoundError: org/camunda/bpm/model/bpmn/BpmnModelInstance
at java.lang.Class.getDeclaredMethods0(Native Method) [rt.jar:1.7.0_60]
at java.lang.Class.privateGetDeclaredMethods(Class.java:2570) [rt.jar:1.7.0_60]
at java.lang.Class.getDeclaredMethods(Class.java:1855) [rt.jar:1.7.0_60]
at org.apache.ibatis.reflection.Reflector.getClassMethods(Reflector.java:279)
at org.apache.ibatis.reflection.Reflector.addGetMethods(Reflector.java:95)
at org.apache.ibatis.reflection.Reflector.<init>(Reflector.java:62)
at org.apache.ibatis.reflection.Reflector.forClass(Reflector.java:463)
at org.apache.ibatis.reflection.MetaClass.<init>(MetaClass.java:34)
at org.apache.ibatis.reflection.MetaClass.forClass(MetaClass.java:38)
at org.apache.ibatis.builder.MapperBuilderAssistant.resolveResultJavaType(MapperBuilderAssistant.java:462)
at org.apache.ibatis.builder.MapperBuilderAssistant.assembleResultMapping(MapperBuilderAssistant.java:411)
at org.apache.ibatis.builder.MapperBuilderAssistant.buildResultMapping(MapperBuilderAssistant.java:222)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.buildResultMappingFromContext(XMLMapperBuilder.java:371)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:276)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElement(XMLMapperBuilder.java:248)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.resultMapElements(XMLMapperBuilder.java:240)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.configurationElement(XMLMapperBuilder.java:113)
at org.apache.ibatis.builder.xml.XMLMapperBuilder.parse(XMLMapperBuilder.java:89)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.mapperElement(XMLConfigBuilder.java:319)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parseConfiguration(XMLConfigBuilder.java:104)
at org.apache.ibatis.builder.xml.XMLConfigBuilder.parse(XMLConfigBuilder.java:89)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.initSqlSessionFactory(ProcessEngineConfigurationImpl.java:663) [camunda-engine-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:337) [camunda-engine-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration.init(JtaProcessEngineConfiguration.java:54) [camunda-engine-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration.init(ManagedJtaProcessEngineConfiguration.java:34) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:306) [camunda-engine-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startProcessEngine(MscManagedProcessEngineController.java:177) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:131) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:129) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.util.Tccl.runWithTccl(Tccl.java:53) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.util.Tccl.runUnderClassloader(Tccl.java:45) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startInternal(MscManagedProcessEngineController.java:129) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:90) [camunda-jboss-subsystem-7.2.0-SNAPSHOT.jar:7.2.0-SNAPSHOT]
... 6 more
Caused by: java.lang.ClassNotFoundException: org.camunda.bpm.model.bpmn.BpmnModelInstance from [Module "org.camunda.bpm.camunda-engine:main" from local module loader @72fd5ba8 (finder: local module finder @578cad92 (roots: /home/developer/server/camunda-bpm-jboss-7.2.0-SNAPSHOT/./server/jboss-as-7.2.0.Final/modules,/home/developer/server/camunda-bpm-jboss-7.2.0-SNAPSHOT/./server/jboss-as-7.2.0.Final/modules/system/layers/base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) [jboss-modules.jar:1.2.0.CR1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) [jboss-modules.jar:1.2.0.CR1]
... 39 more

Any idea?

Best regards
Halil

Am Sonntag, 6. Juli 2014 15:18:09 UTC+2 schrieb Mark Struberg:

Daniel Meyer

unread,
Jul 15, 2014, 3:46:51 AM7/15/14
to camunda-...@googlegroups.com
Hi Halil,

seems like you are missing this class" org/camunda/bpm/model/bpmn/BpmnModelInstance"

What JBoss configuration are you using. Pre-packaged distro or did you install the modules yourself?

Cheers,
Daniel

Daniel Meyer

unread,
Jul 15, 2014, 3:48:50 AM7/15/14
to camunda-...@googlegroups.com
Sorry, I just read that you built the distribution yourself. 

Note that Mark's Pull request is not merged yet: https://github.com/camunda/camunda-bpm-platform/pull/85

Daniel

Halil

unread,
Jul 15, 2014, 5:06:12 PM7/15/14
to camunda-...@googlegroups.com
Hi Daniel,

okay thanks - good to know. I will test it if it's merged next time.

Best regards
Halil
Reply all
Reply to author
Forward
0 new messages