How to set the working directory path relative to the deployment folder in Mule 3

718 views Asked by At

I placed the JKS file in src/main/resources/truststore/xyz.jks and want to use it in a Spring configuration for a JDBC connection over SSL in Mule 3.

The configuration is working if I run it in Anypoint Studio, but RTF (Anypoint Runtime Fabric) deployment is returning the error:

java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

I can access it as ${app.home}/truststore/xyz.jks in Mule 4 but it is not working for Mule 3.

How can I configure the path for the jks file in RTF deployment for the Mule3 application?

trustStore=${mule.home}/apps/${app.name}/classes/truststore/xyz.jks
<spring:beans>
        <spring:bean id="validDataSource" name="validDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
            <spring:property name="driverClass" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
            <spring:property name="jdbcUrl" value="jdbc:sqlserver://${database.server.url}:${database.server.port};DatabaseName=${database.suburb.name};encrypt=true;trustServerCertificate=false;trustStore=${mule.home}/apps/${app.name}/classes/truststore/xyz.jks;trustStorePassword=${db.trustStorePassword};hostNameInCertificate=${database.server.url}"/>
1

There are 1 answers

1
aled On

The path seems to be correctly constructed. Verify that the trust store file is actually contained in the deployable zip file. Use any tool to inspect or decompress the zip file and see if the file is at the expected directory (classes/truststore).

For example it may not be packaged if you are using Maven and Maven Resource plugin. If that is the issue you can explicitly avoid filtering in the plugin:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<configuration>
<nonFilteredFileExtensions>
<nonFilteredFileExtension>jks</nonFilteredFileExtension>
</nonFilteredFileExtensions>
</configuration>
</plugin>

Source: https://help.mulesoft.com/s/article/Getting-java-security-InvalidAlgorithmParameterException-the-trustAnchors-parameter-must-be-non-empty-in-cloudhub

There maybe some other cause that prevents the file to be added in the Maven build. You'll have to analyze it or share the pom.xml.