Problems using camunda-bpm-mail connectors

Hello everyone,

I am trying to get a process running using camunda-bpm-mail extension. It is built the same way as the pizza example with a mail-poll connector as first task.

When the unit tests are running I get an info message:
00:37:43.733 [main] INFO org.camunda.bpm.connect - CNCT-01004 Discovered provider for connector id ‘mail-send’ and class ‘org.camunda.bpm.extension.mail.send.SendMailConnector’: ‘org.camunda.bpm.extension.mail.send.SendMailProvider’
00:37:43.734 [main] INFO org.camunda.bpm.connect - CNCT-01004 Discovered provider for connector id ‘mail-poll’ and class ‘org.camunda.bpm.extension.mail.poll.PollMailConnector’: ‘org.camunda.bpm.extension.mail.poll.PollMailProvider’
00:37:43.736 [main] INFO org.camunda.bpm.connect - CNCT-01004 Discovered provider for connector id ‘mail-delete’ and class ‘org.camunda.bpm.extension.mail.delete.DeleteMailConnector’: ‘org.camunda.bpm.extension.mail.delete.DeleteMailProvider’

Since tests passed, I deployed my war file.
As stated in the readme the required dependencies are all inside my war in META-INF\lib:

  • camunda-bpm-mail-core-1.0.0
  • camunda-connect-core-1.0.3
  • javax.mail-1.5.5
  • slf4j-api-1.7.21

After successfully deploying mywar I try to start a Task via TaskList.
The process fails with internal server error and the application server throws exceptions:

org.camunda.connect.ConnectorException: No connector found for connector id 'mail-poll'
Obviously, Wildlfy doesn’t discover the new connectors. But I don’t know why. Any help is appreciated! Thanks!

Which Camunda version do you use?
And do you use a shared process engine?

Hi Thorben,

I am using the current 7.5.0 WildFly 10 distribution. As far as I understand this uses the shared process engine.
The required libs are alle taken from maven repository in the latest version.

Okay. The connector needs to be on the classpath of the Camunda Connect process engine plugin. In a shared engine setting, that means that these dependencies cannot be part of your application since the plugin is not provided by your application. On Wildfly, you’ll have to extend the descriptor of module org.camunda.bpm.camunda-engine-plugin-connect and add a dependency to the mail connector. That requires that you create a Wildfly module for the mail connector.

Cheers,
thorben

1 Like

Hi Thorben,

ok, so with a little help from the Wildfly IRC I got a working module. I’m pretty sure it get’s properly loaded, since it first complained about one of the dependencies which is now resolved.

<module xmlns="urn:jboss:module:1.0" name="org.camunda.bpm.extension.camunda-bpm-mail-core">
  <resources>
    <resource-root path="camunda-bpm-mail-core-1.0.0.jar" />
  </resources>

  <dependencies>
    <module name="javax.mail.api" />
    <module name="org.slf4j" />
    
    <module name="org.camunda.connect.camunda-connect-core" />
  </dependencies>
</module>

Furthermore I added the the dependency in camunda-engine-plugin-connect

<module xmlns="urn:jboss:module:1.0" name="org.camunda.bpm.camunda-engine-plugin-connect">
  <resources>
    <resource-root path="camunda-engine-plugin-connect-7.5.0.jar" />
  </resources>

  <dependencies>

    <module name="javax.api" />

    <module name="org.camunda.bpm.camunda-engine" />

    <module name="org.camunda.connect.camunda-connect-core" />
    <module name="org.camunda.connect.camunda-connect-http-client" services="import" />
    <module name="org.camunda.connect.camunda-connect-soap-http-client" services="import" />
    <module name="org.camunda.bpm.extension.camunda-bpm-mail-core" services="import" />
  </dependencies>
</module>

Now the wildfly servers tries to load it, but something is still missing:

20:23:37,643 INFO [org.camunda.bpm.connect] (ServerService Thread Pool – 60) CNCT-01004 Discovered provider for connector id ‘http-connector’ and class ‘org.camunda.connect.httpclient.impl.HttpConnectorImpl’: ‘org.camunda.connect.httpclient.impl.HttpConnectorProviderImpl’
20:23:37,655 INFO [org.camunda.bpm.connect] (ServerService Thread Pool – 60) CNCT-01004 Discovered provider for connector id ‘soap-http-connector’ and class ‘org.camunda.connect.httpclient.soap.impl.SoapHttpConnectorImpl’: ‘org.camunda.connect.httpclient.soap.impl.SoapHttpConnectorProviderImpl’
20:23:37,663 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool – 60) MSC000001: 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/engine/ProcessEngineException
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:97)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.NoClassDefFoundError: org/camunda/bpm/engine/ProcessEngineException
at org.camunda.bpm.extension.mail.send.SendMailProvider.createConnectorInstance(SendMailProvider.java:27)
at org.camunda.connect.Connectors.registerProvider(Connectors.java:183)
at org.camunda.connect.Connectors.registerConnectors(Connectors.java:173)
at org.camunda.connect.Connectors.initializeConnectors(Connectors.java:160)
at org.camunda.connect.Connectors.loadConnectors(Connectors.java:95)
at org.camunda.connect.plugin.impl.ConnectProcessEnginePlugin.preInit(ConnectProcessEnginePlugin.java:31)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.invokePreInit(ProcessEngineConfigurationImpl.java:674)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:621)
at org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration.init(JtaProcessEngineConfiguration.java:58)
at org.camunda.bpm.container.impl.jboss.config.ManagedJtaProcessEngineConfiguration.init(ManagedJtaProcessEngineConfiguration.java:40)
at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:612)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startProcessEngine(MscManagedProcessEngineController.java:177)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:131)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$2.run(MscManagedProcessEngineController.java:129)
at org.camunda.bpm.container.impl.jboss.util.Tccl.runWithTccl(Tccl.java:53)
at org.camunda.bpm.container.impl.jboss.util.Tccl.runUnderClassloader(Tccl.java:45)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController.startInternal(MscManagedProcessEngineController.java:129)
at org.camunda.bpm.container.impl.jboss.service.MscManagedProcessEngineController$1.run(MscManagedProcessEngineController.java:90)
… 6 more
Caused by: java.lang.ClassNotFoundException: org.camunda.bpm.engine.ProcessEngineException from [Module “org.camunda.bpm.extension.camunda-bpm-mail-core:main” from local module loader @1e5ccce (finder: local module finder @42bbf4 (roots: D:\Dev\camunda-bpm-wildfly10-7.5.0\server\wildfly-10.0.0.Final\modules,D:\Dev\camunda-bpm-wildfly10-7.5.0\server\wildfly-10.0.0.Final\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
… 24 more

Looking at the stacktrace it doesn’t look like it’s a Wildfly specific error.

Hi @Brutus5000,

Apparently, the mail connector has a dependency to the process engine (it uses ProcessEngineException somewhere). You can try adding a dependency <module name="org.camunda.bpm.camunda-engine" /> to the connector module.

Cheers,
Thorben

1 Like

Hi Thorben,

thank you very much. I got it running now.
The following steps are required:

1. Create a module for camunda-bpm-mail-core:
Copy the jar into \server\wildfly-10.0.0.Final\modules\org\camunda\bpm\extension\camunda-bpm-mail-core\main and add a module.xml with following content:

<module xmlns="urn:jboss:module:1.0" name="org.camunda.bpm.extension.camunda-bpm-mail-core">
  <resources>
    <resource-root path="camunda-bpm-mail-core-1.0.0.jar" />
  </resources>

  <dependencies>
    <module name="javax.mail.api" />
    <module name="org.slf4j.api" />
    
    <module name="org.camunda.bpm.camunda-engine" />
    <module name="org.camunda.connect.camunda-connect-core" />
  </dependencies>
</module>

2. Create a module for slf4j.api:
Copy the jar into \server\wildfly-10.0.0.Final\modules\org\slf4j\api\main and add a module.xml with the following content:

<module xmlns="urn:jboss:module:1.0" name="org.slf4j.api">
  <resources>
    <resource-root path="slf4j-api-1.7.21.jar" />
  </resources>
</module>

3. Import the mail module in the connect-plugin:
Change the module.xml in \server\wildfly-10.0.0.Final\modules\org\camunda\bpm\camunda-engine-plugin-connect\main
Add the line
<module name="org.camunda.bpm.extension.camunda-bpm-mail-core" services="import" />

4. Restart the server

That should do it.

2 Likes

Great. Thanks for sharing the solution.

Hi,

I noticed a difference between the instructions in this post and the instructions on camunda-platform-7-mail/docs/shared-process-engine-wildfly.md at main · camunda-community-hub/camunda-platform-7-mail · GitHub

The camunda-bpm-mail-core module.xml has an extra line

<module name="org.camunda.bpm.camunda-engine" />

Which one is correct?

Also, what are the full steps for a wildfly, shared-engine?
The github link says

If you use Wildfly, follow the special instructions.

but do I have to follow only this part, or should I add the dependencies mentioned above that line in github, in my pom.xml?
Do I have to add the

camunda-bpm-mail-core-1.1.0.jar

in camunda-bpm-wildfly10-7.8.0\lib?

Thx

As my original post was related to a different Camunda version and a different Wildfly version I assume that the official docs are more up to date. I can’t tell you how to do it now, as I have moved to the embedded process engine with Spring framework.

Maybe somebody else can help you.