Salesforce

How can I set Mule and Java system properties at startup?

« Go Back

Information

 
Content

GOAL

Set up Java properties or Mule environment variables for a Mule Runtime instance

PROCEDURE

Mule is normally started from a batch or shell script (e.g. mule.bat). In order to pass JVM arguments and properties to Mule, you can use either of the following approaches:

  • Add new wrapper.java.additional.N entry into the wrapper.conf file (where N=the associated property number)

  • Use the -M command line argument

Note: this will set the system property for all Mule applications deployed in that Mule runtime. As an alternative, you could simply want to set properties for your particular application if you don't need to change the behavior of the JVM or an external library.

Modifying Wrapper Configuration

Mule is actually started by the Java Service Wrapper, which uses a wrapper.conf configuration file within the <MULE_HOME>/conf directory. A JVM argument can be added using this format:
wrapper.java.additional.6=-Dorg.mule.xml.validate=false

Setting properties on the command line when starting Mule

The startup script for Mule allows you to enter ad-hoc JVM arguments via the -M flag (see MULE-2601). The format is:

mule -config <config.file> -M<argument.1> -M<argument.2>

For instance:

$ mule -config foo.xml -M-Dorg.mule.xml.validate=false -M-Djava.mail.debug=true

Anypoint Studio

  • When running an application inside Studio you can set JVM parameters in the Run Configuration: Menu Run / Run Configurations... / Arguments tab / VM Arguments. Use the standard Java format for parameters.
Example:
-Dorg.mule.xml.validate=false -Djava.mail.debug=true
  • Another option is to add the arguments in the wrapper.conf file from the Mule Runtime bundled in Studio. 

    Please note with this option you will add the arguments in all your mule applications used by the runtime. The instructions can be found here


CloudHub & Runtime Fabric applications

If you are deploying your application to CloudHub/RTF just add the property as you would with any other application property, don't include any hyphens or command line parameter.

  • In Cloudhub both Mule and JVM properties need to be set in properties tab
  • In Runtime Fabric Mule properties need to be set in properties tab, and JVM properties in JVM tab

Example:

org.mule.xml.validate=false
java.mail.debug=true
MUnit - VM arguments for recorder
The instructions to enforce UTF-8 encoding for Transform Message output can be found here.

See Setting CloudHub Application Properties
Attachments

Powered by