Camunda-bpm-mail extension with multiple configurations

Hi

I’m trying to use the camunda-bpm-mail extension developed by the community

my mail-config.properties file is located inside /src/main/resources which is the normal location for such files. the documentation indicates that unless we want to place mail-config.properties file somewhere else (e.g. $CATALINA_HOME/conf/ ) then we must set an environment variable MAIL_CONFIG for the connector to work. when I don’t copy the mail-config.properties file to tomcat config folder I get the error no config file found in class path

java.lang.IllegalStateException: Cannot find mail configuration at: classpath:/mail-config.properties

which makes no sense, since my mail-config.properties is inside the default folder location “/src/main/resources”. I managed to get the connector to work when I copy mail-config.properties to tomcat config folder and setting MAIL_CONFIG but that’s not what I want. because maybe different processes may use different mail-server configurations, placing the mail-config file in tomcat config folder and setting an environment will limit the connector to only one configuration.

any idea what might be wrong? is there someone who managed to get the connector to work with the default setup ?

Do you include the mail connector as a library in your application or as a shared library in Tomcat?

I added it as a dependency in my application but I copied the jar file “camunda-bpm-mail-core.jar” to the tomact /lib/ folder.

Hi @hassank,

currently, the mail configuration applies globally to all processes of the process engine. You can’t have different configurations. However, this could be a good improvement.

Best regards,
Philipp

Hello @Philipp_Ossler

I’m having this exception:

Caused by: java.io.FileNotFoundException: C:\Server\camunda\server\apache-tomcat-9.0.12\conf (Acceso denegado)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(FileInputStream.java:195)
at java.io.FileInputStream.(FileInputStream.java:138)
at org.camunda.bpm.extension.mail.config.PropertiesMailConfiguration.getProperiesAsStream(PropertiesMailConfiguration.java:152)
at org.camunda.bpm.extension.mail.config.PropertiesMailConfiguration.loadProperties(PropertiesMailConfiguration.java:116)
… 89 more

I have the MAIL_CONFIG variable setted in star-camunda.bat, but it seems not having access. I’m not a tomcat administrator and probably the solution is easy…

Thanks!

Hello @Tomas_Giner

the solution is add the environment variable not only for the folder the config is in, add the complete path for you following should work:

C:\Server\camunda\server\apache-tomcat-9.0.12\conf\mail-config.properties

Thank’s a lot for your answer. I managed to solve the problem in other way: calling an external Rest service, but it’s good to know that there is a solution.
Regards!

Hi,

I’m using a Wildfly Shared Process Engine distro.
I put the mail-config.properties file under ~\camunda-bpm-wildfly10-7.8.0\server\wildfly-10.1.0.Final\standalone\configuration
and I add this line:

set “MAIL_CONFIG=%JBOSS_HOME%\standalone\configuration\mail-config.properties”

in ~\camunda-bpm-wildfly10-7.8.0\server\wildfly-10.1.0.Final\bin\standalone.bat file.

But how can I call this file in my code?

Thx

Actually I found how to do this, but if I want to set it up for a Linux machine, what do I need to do?
Should I edit the standalone.sh file? Or the standalone.xml?