I am evaluating Camunda and the mail connector extension for possible usage in our projects
But we meet problem
Used Environment:
Adopt Open JDK 11
Camundas Pre-Packaged Distribution 7.15 for WildFly
Installing the mail connector camunda-bpm-mail-core:1.3.0 following the provided instructions.
Install the Extension for a Shared Process Engine on Wildfly
My experimental process flow (snipped) is as follows:
Connector: mail-poll ==> Service task: Process Mails
The good news is: The polled mails arrive correctly filled via the process variable âmailsâ
in the service task.
Also the received class name is correct.
Log output; âClass of mail is: org.camunda.bpm.extension.mail.dto.Mailâ
But the further processing fails:
Here is my code snippet of the execute method of my service task:
public final class ServiceTaskProcessMails implements JavaDelegate {
// Snipped
@Override
public void execute(final DelegateExecution execution) {
List mails = (ArrayList) execution.getVariable("mails");
if (mails == null) {
throw new IllegalStateException("Process variable \"mails\" not set");
}
LOGGER.info("Found {} mails in inbox", mails.size());
if (mails.size() > 0) {
// This works and shows correct data
LOGGER.info("Mail: {}", mails.get(0).toString());
// What kind of class we got?
LOGGER.info("Class of mail is: {}", mails.get(0).getClass().getName());
// This causes an exception
Mail mail = (Mail) mails.get(0);
}
}
}
The line with the cast: âMail mail = (Mail) mails.get(0)â causes the following exception:
many lines down:
Caused by: java.lang.NoClassDefFoundError: org/camunda/bpm/extension/mail/dto/Mail
Changing the dependency scope of âcamunda-bpm-mail-coreâ from âprovidedâ to âcompileâ within
the pom it becomes clearer what is going on here:
Now the exception says:
org.camunda.bpm.extension.mail.dto.Mail cannot be cast to
class org.camunda.bpm.extension.mail.dto.Mail
lines deleted
(org.camunda.bpm.extension.mail.dto.Mail is in unnamed module of loader
âorg.camunda.bpm.extension.camunda-bpm-mail-core@1.3.0â @22d0c2d6;
org.camunda.bpm.extension.mail.dto.Mail is in unnamed module of loader
âdeployment.opvdemo.warâ @c86416e):
That means the Mail classes are loaded by different class loaders and cannot be castet eachother.
Also interesting in this context is:
A similar problem with class loading shows up when deploying the print-service example.
During deploy within the PostDeploy Method of class PrintServiceProcessApplication.java
the following exception is thrown, and the deployment fails:
lines deleted
Caused by: java.lang.NoClassDefFoundError:
org/camunda/bpm/extension/mail/config/MailConfigurationFactory
Any ideas?
Maybe adjusting WildFly config ???
Greetings from Munich
Stephan

