cancel
Showing results for 
Search instead for 
Did you mean: 

Problems with Email Configuration

mwolf
Champ on-the-rise
Champ on-the-rise

Hey Everybody! I Use Activit in Karaf, an OSGI Container. To make the E-Mail Configuration Editable during runtime i put the valuses into an *.cfg folder. In the Blueprint i load the config from the cfg file. 

<cm:property-placeholder persistent-id="com.example.bpmn" update-strategy="reload"  placeholder-prefix="$["
                         placeholder-suffix="]">
    <cm:default-properties>
        <cm:property name="cfg.mailServerHost" value="localhost" />
        <cm:property name="cfg.mailServerUsername" value="admin" />
        <cm:property name="cfg.mailServerPassword" value="admin" />
        <cm:property name="cfg.mailServerPort" value="25" />
        <cm:property name="cfg.useSSL" value="true" />
        <cm:property name="cfg.useTLS" value="true" />
        <cm:property name="cfg.mailServerDefaultFrom" value="johndoe@localhost" />
    </cm:default-properties>
</cm:property-placeholder>

<bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
    <property name="URL" value="jdbc:h2:~/activiti"/>
    <property name="user" value="sa"/>
    <property name="password" value=""/>
</bean>

<reference id="transactionManager" interface="javax.transaction.TransactionManager"/>


<bean id="configuration" class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration"
      ext:field-injection="true">
    <property name="databaseType" value="h2"/>
    <property name="dataSource" ref="dataSource"/>
    <property name="transactionManager" ref="transactionManager"/>
    <property name="databaseSchemaUpdate" value="true"/>
    <property name="transactionsExternallyManaged" value="true"/>
    <property name="defaultCamelContext" value="defaultContext"/>
    <property name="mailServerHost" value="$[cfg.mailServerHost]"/>
    <property name="mailServerUsername" value="$[cfg.mailServerUsername]"/>
    <property name="mailServerPassword" value="$[cfg.mailServerPassword]"/>
    <property name="mailServerPort" value="$[cfg.mailServerPort]"/>
    <property name="useSSL" value="$[cfg.useSSL]" />
    <property name="useTLS" value="$[cfg.useTLS]" />
    <property name="mailServerDefaultFrom" value="$[cfg.mailServerDefaultFrom]"/>
</bean>

This works fine for me but if i have a Email Server without Authentication i earn an Error if i pass only empty values into the mailServerUsername and the mailServerPassword. Only Surrounding in the blueprint with a comment, so nothing pass into the process engine helps for this. is it possible to make this Optional in the config? 

7 REPLIES 7

danielsmith12
Champ in-the-making
Champ in-the-making

I have the same problem in working with college essay writing service.

Thank you!

gdharley
Elite Collaborator
Elite Collaborator

What happens if you simply leave the username and password properties out of your process engine configuration bean declaration?

Thanks,

Greg

mwolf
Champ on-the-rise
Champ on-the-rise

Well, this works. The Problem is if you want to use both, depending on the installation then you have to rebuild the complete project for this change. if i leave the fields empty, they will also send a empty username and password to the server, but this is not the same like having no auth parameters. i want to set them optional... is there any chance? 

gdharley
Elite Collaborator
Elite Collaborator

Yeah, this is what I expected. If you look at the configuration impl class, the userid and password are null unless declared.

By declaring a "" it is no longer null and is being passed in.

Short of building a custom configuration impl class (which isn't hard, just extend the class you are using) you can't have it both ways.

Greg