Troubleshooting MuleSoft Maven deployment issues

Unfortunately sometimes you run in to unexpected behavior when deploying your MuleSoft application using Maven. You have confirmed that everything is configured correctly. But then you run into a ugly null pointer exception. When this happens the best thing to do is to run the Maven command with extra debug settings using the -X option.

You can set this option in Anypoint Studio. Run -> Configuration -> Maven command line arguments:

Anypoint Studio - Maven command line arguments
deploy -P clouddeploymentprofile -Dhttps.proxyHost=proxy.machine -Dhttps.proxyPort=8080 -Dhttps.proxyUser=domain\username -Dhttps.proxyPassword=password -DmuleUsername=usernameCloudhub -DmulePassword=passwordCloudhub -Denv=development -Danypoint.platform.workerType=Micro -X

In your POM, Parent POM or properties files you have configured settings which are being used to deploy your application.  For example when you try to deploy to an Anypoint Runtime (ARM) On Premise server and you have a EU plane you also need to specify the region in your POM.


<region>eu-central-1</region>

This may seem counterintuitive because the on-premise runtimes are not running in the AWS Amazone Cloudhub datacenter. But after reviewing the debug logging it is apparent that you also need to specify the location of the management platform. The default setting when deploying assumes your management plane is based in the US. And then deployment fails with a null pointer exception because it cannot locate the management platform. When you run Maven with the -X option and scroll way up in the log file you can view the settings used with the deployment. 

Listed below is a section of the Maven debug output. In this section of the  log you can view the settings that Maven uses to deploy your application:

<configuration>

  <application>example-api</application>

  <applicationName>example-api</applicationName>

  <arguments>${mule.arguments}</arguments>

  <armInsecure default-value="Medium">false</armInsecure>

  <businessGroup default-value="">mybusinnessgroup</businessGroup>

  <community default-value="false">${mule.community}</community>

  <deploymentTimeout default-value="60000">${mule.deployment.timeout}</deploymentTimeout>

  <deploymentType>arm</deploymentType>

  <environment>acceptance</environment>

  <localRepository default-value="${localRepository}"/>

  <muleHome>${mule.home}</muleHome>

  <muleVersion>3.9.1</muleVersion>

  <password>******</password>

  <properties>

    <anypoint.platform.client_id>4b072f0298*******15b9b005b</anypoint.platform.client_id>

    <anypoint.platform.client_secret>1B574994e*****7E7204</anypoint.platform.client_secret>

    <anypoint.platform.platform_base_uri>https://eu1.anypoint.mulesoft.com/apiplatform</anypoint.platform.platform_base_uri>

    <anypoint.platform.coreservice_base_uri>https://eu1.anypoint.mulesoft.com/accounts</anypoint.platform.coreservice_base_uri>

    <anypoint.platform.contracts_base_uri>https://eu1.anypoint.mulesoft.com/apigateway/ccs</anypoint.platform.contracts_base_uri>

    <anypoint.platform.analytics_base_uri>https://analytics-ingest.eu1.anypoint.mulesoft.com</anypoint.platform.analytics_base_uri>

    <env>acceptatie</env>

  </properties>

  <region default-value="us-east-1">${cloudhub.region}</region>

  <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-wp-preserve="%3Cscript%3E%24%7Bscript%7D%3C%2Fscript%3E" data-mce-resize="false" data-mce-placeholder="1" class="mce-object" width="20" height="20" alt="<script>" title="<script>" />

  <server>${maven.server}</server>

  <size default-value="2"/>

  <skip>${mule.skip}</skip>

  <target>${anypoint.target}</target>

  <targetType>${anypoint.target.type}</targetType>

  <timeout>${mule.timeout}</timeout>

  <uri default-value="[https://anypoint.mulesoft.com%22%3ehttps/eu1.anypoint.mulesoft.com%3C/uri]https://anypoint.mulesoft.com">https://eu1.anypoint.mulesoft.com</uri>

  <username>jenkins</username>

  <workerType default-value="Medium">${cloudhub.workerType}</workerType>

  <workers>${cloudhub.workers}</workers>

  <mavenProject default-value="${project}"/>

  <settings default-value="${settings}"/>

</configuration>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.