This white paper provides a comprehensive migration framework for organizations upgrading to Mule Runtime 4.9 and Java 17.
Keeping your Mule versions up-to-date is vital for leveraging the full potential of your integration platform. Regular upgrades grant you access to the latest features, enhancements, and fixes, bolstering your system's performance and security. Stay compatible, reduce risks, and maintain a robust integration environment with MuleSoft.
Note:
If you have a Salesforce Premier or Signature Success plan, you can unlock access to additional expert coaching session to guide you on best practices to be followed during your migration journey . This help is provided by experts from our Success Guides and Architects team to help you succeed on an issue-free Java migration.
To avail the services of our Success Guides or Architects, please
1. Pre-Flight Architecture Audit
Before updating any code, your environment must be certified for Java 17 compliance. Skipping any of these steps can result in runtime failures that appear successful during build and deployment.
Action Required: Upgrade to Anypoint Studio 7.21 or later
Detailed Technical Requirements:
Verify JAVA_HOME in AnypointStudio.ini points to JDK 17
Ensure mule-artifact.json has minMuleVersion set to 4.9.0
Impact of Omission: Failure to use Studio 7.21+ results in an "invisible" module scanner issue, leading to successful builds that fail only during runtime deployment.
Reference: MuleSoft Java 17 Upgrade Tutorial provides a visual walkthrough of environment and project settings in Anypoint Studio 7.21.
Action Required: Update the distributionManagement section in pom.xml to use the /maven/v3 URL
CloudHub 2.0 Critical Warning: Using v1/v2 facades prevents scheduler metadata from being registered. Schedulers will run in the background but will be invisible in the Runtime Manager UI, creating a monitoring blind spot.
Action Required: Upgrade JSON Logger to v2.1.0+ or migrate to the official Custom Logger module
Technical Context: Legacy loggers (v1.x) use PropertyUtils which is blocked by Java 17's strict encapsulation model.
Impact of Omission: Application will fail to initialize with IllegalReflectiveAccess exception during log4j startup. This is a hard crash scenario.
Action Required: Verify API Manager alerts against subscription limits in Access Management
Hidden Risk: Subscription-level "Alert Fatigue" where applications are blocked despite appearing healthy in Runtime Manager.
Caveat: The UI lacks a unified dashboard. Limits must be manually verified in the "Subscription" tab of Access Management.
Critical Recommendation: Never Skip Runtime Versions
Best Practice: Plan incremental upgrades: 4.3 → 4.4 → 4.6 → 4.9
Rationale: Incremental upgrades expose issues gradually, making troubleshooting significantly easier. Jumping from 4.3 directly to 4.9 can trigger multiple overlapping issues that are difficult to isolate.
Action Items:
Document your upgrade path for each environment
Plan testing strategy for each incremental version
Allow adequate time between version upgrades for validation
Java 17 adopts a different memory commitment strategy than Java 8. In containerized environments (RTF), the G1GC (now the default garbage collector) may not reclaim Metaspace aggressively enough, leading to "Anxiety Restarts" where Pods are killed by OOM (Out of Memory).
The Fix: Configure the following JVM arguments:
-XX:MetaspaceSize=256m
-XX:MaxMetaspaceSize=512m
Why It Works:
MetaspaceSize=256m: Sets the initial threshold for garbage collection
MaxMetaspaceSize=512m: Establishes a hard cap to prevent pod eviction
Setting the MetaspaceSize threshold forces the JVM to perform a Full GC when class metadata grows, reclaiming unused space from redeployed apps or heavy DataWeave transformations.
Mule 4.9 defaults to G1GC (Garbage First Garbage Collector). If your legacy 4.4 applications used ParallelGC tuning, those arguments will now cause performance regressions.
Suggestions:
Remove: -XX:+UseParallelGC and -XX:NewRatio
Add: -XX:MaxGCPauseMillis=200, and its already the G1 default
Note:
These suggestions should be considered as a starting baseline for tuning. It is important to validate performance under your specific workload and adjust the parameters based on your SLA requirements
Problem Pattern: Applications utilizing DataWeave expressions that reference error.muleMessage or error.errorType.asString within error handling flows experience runtime failures when deployed on Java 17-based environments.
Root Cause: These are internal variables. Accessing them triggers a recursive lookup operation within the modular classloader architecture. Under Java 17's enhanced module system constraints, this recursive behavior culminates in a StackOverflowError, causing application failure.
The Fix: Replace all occurrences with supported alternatives:
Replace:
error.muleMessage
error.errorType.asString
With:
error.description
error.errorMessage.payload
These alternative expressions provide equivalent error information while avoiding the recursive classloader behavior.
Reference: MuleSoft Error Concept Documentation
For customers with custom connectors or interceptors:
Parent POM Update:
Update to mule-modules-parent version 1.9.0 or later
Refactoring Guidance:
Avoid using java.lang.reflect on internal Mule classes
If reflection is unavoidable, use: --add-opens java.base/java.lang=ALL-UNNAMED
Edge Case - CloudHub 2.0: The --add-opens flag is not supported on Mule Runtime 4.5 later. Code must be refactored to be fully compliant before deployment.
Known Issue: The Mule Runtime's validation process currently rejects --add-opens parameters due to internal constraints. This validation is enforced during runtime startup, resulting in IllegalArgumentException.
Recommendation: There is no supported method to bypass the automatic addition of conflicting --add-opens parameters by the Mule runtime. Customers are advised to refrain from using these parameters in their configurations and refactor code accordingly.
Behavior Change: DataWeave 2.5.0 (shipped with Mule 4.6+) changed the default behavior for handling trailing zeroes in numeric values.
Version Comparison:
DataWeave 2.4.0: Preserved trailing zeroes for formats like DataWeave, JSON, and YAML (e.g., 1.50)
DataWeave 2.5.0+: Removes trailing zeroes by default (e.g., 1.5)
Impact: Applications that rely on exact numeric formatting (financial calculations, reporting, API contracts) may experience unexpected data transformations.
Resolution: To restore the 2.4.0 behavior and preserve trailing zeroes, set the system property:
com.mulesoft.dw.stripTrailingZeroes=false
Action Items:
Identify DataWeave transformations that output numeric values to JSON, YAML, or DataWeave formats
Test transformations in 4.6+ to identify formatting differences
Add system property if preservation of trailing zeroes is required
Document the property setting in your deployment configuration
Reference: DataWeave System Properties Documentation
Issue: Customers using SAP JCo version 3.1.12 (the latest available) experience connection test failures with the following error:
Test connection failed: JCo initialization failed with
java.lang.ExceptionInInitializerError: Illegal JCo archive
"com.sap.conn.jco.sapjco3-3.x.x.jar" It is not allowed to
rename or repackage the original archive "sapjco3.jar"
Root Cause:
org.mule.runtime.api.exception.MuleRuntimeException:
org.mule.runtime.api.lifecycle.LifecycleException: Failed to invoke
lifecycle phase "initialise" on object
This issue occurs due to stricter validation introduced by SAP in version 3.1.12.
Environment:
SAP JCo Version: 3.1.12
Connector Version: 5.9.12
Java Version: 17
Mule Version: 4.9.x
Deployment Targets: CloudHub, CloudHub 2.0, On-premise, Runtime Fabric (RTF)
Workaround:
Option 1:
Pass a system property that explicitly points to the native SAP JCo library:
-Djco.library=/absolute/path/to/libsapjco3.[dll|so|dylib]
Platform-Specific Extensions:
Windows: .dll
Linux: .so
macOS: .dylib
Important Notes:
The path must be an absolute path to the native file
This workaround is only effective if dependencies are located inside the application at src/main/resources
Known Limitation: This approach creates significant challenges for customers during upgrades and is often incompatible with standard workflows. Many organizations use repository managers like JFrog, where Maven automatically fetches dependencies during the build phase.
What Won't Work: You cannot use dynamic path values like:
-Djco.library=${MULE_HOME}/apps/${app.name}/repositories/com/sap/conn/jco/libsapjco3/3.1.12/<name>
This will fail because Maven fetches dependencies dynamically, and when it can't find them at the expected location, a classloader issue will occur.
Option 2:
To resolve this error, add the following maven-shade-plugin configuration to the Mule application pom.xml file. In the code below, replace the placeholders "sapjco3-group-id:sapjco3-artifact-id" and "sapidoc3-group-id:sapidoc3-artifact-id" with the the actual group and artifact IDs from your SAP dependencies
KB article for more details: https://help.salesforce.com/s/articleView?id=005108677&type=1
Version Requirement: Only version 2.0.3 and later support Java 17
Key Change: Apache Mina library upgrade required for Java 17 compatibility
Action Required: Review the upgrade guide to understand breaking changes and migration steps and Explicitly set workingDir="/" or baseDir="/"
Technical Context: Java 17 connectors no longer assume / as the default directory. This behavioral change is due to stricter path resolution in the updated connector libraries.
Impact of Omission:
"Path Not Found" error
Relative-path errors (e.g., attempting to access /tmp inside /home/mule)
Reference: SFTP Connector Upgrade Guide
Issue: The Web Service Consumer connector and the Until Successful scope suppress errors from reporting outside their namespaces.
Example: A connectivity error at the Web Service Consumer (HTTP:CONNECTIVITY) is being suppressed in standard logging.
Resolution: To access the complete error information, add the system property:
mule.suppress.mule.exceptions=false
Reference: Feature Flagging Documentation
Issue: After upgrading from Mule Runtime 4.4.0 to 4.6.3, DATE columns from database queries (Snowflake and Database Connectors) return different formats, breaking existing DataWeave transformations.
Format Comparison:
Mule 4.4.0: "2021-01-24T00:00:00" (DateTime)
Mule 4.6.3: "2021-01-24" (Date)
Root Cause: Mule 4.4.0 had a bug where java.sql.Date was incorrectly mapped to DateTime instead of Date. This was corrected in subsequent releases. The 4.6+ behavior is correct per database specifications (DATE type doesn't store time components).
Resolution: For Mule 4.4.x users experiencing this issue after upgrading, enable the system property:
com.mulesoft.dw.javaSqlDateToDate=true
This property maps java.sql.Date to Date (instead of DateTime), aligning 4.4 behavior with 4.5+ versions while maintaining backward compatibility control.
Action Items:
Identify all database queries that return DATE columns
Review DataWeave transformations that process these date values
Test transformations with the new date format
Add system property if backward compatibility with 4.4.x format is required
Reference: DataWeave System Properties
Action Required: Upgrade to Amazon S3 Connector version 8.x
Migration Guide: The connector has significant changes in version 8.x that require code updates.
Reference: Upgrading and Migrating Amazon S3 Connector to Version 8.x
Resources:
Java 17 Compatible Anypoint Connectors - Access this article for a comprehensive list of MuleSoft Anypoint connectors that are Java 17 compatible.
How to check MuleSoft Java 17 Connector Compatibility- Refer to this article on how to check if the Java 17 connector is compatible with your modules.
Best Practice: Create an inventory of all connectors used across your application portfolio before beginning migration planning.
Deploy to non-production environment first
Execute full regression test suite
Monitor memory consumption patterns
Verify all scheduled jobs appear in Runtime Manager
Test error handling scenarios
Validate DataWeave transformations (numeric formats, date formats)
Load test to identify GC pause time impacts
Verify database query performance
Create rollback plan (including API-based rollback procedure)
Schedule deployment during low-traffic window
Enable enhanced monitoring for first 48 hours
Document baseline performance metrics before migration
Keep JDK 8/11 compiled artifacts available for emergency rollback
Brief operations team on new JVM parameters and their impact
8. Operations & The "Safety Net" Protocol
Critical Warning: Once an application is upgraded to 4.9 in Runtime Manager UI, the dropdown option for 4.4 is automatically removed. This is intentional to prevent accidental rollback to an unsupported Java 8 environment.
Planning Implication: Test thoroughly in lower environments before production upgrades. UI-based rollback is not possible.
If an emergency downgrade is required, it must be performed via the AMC Application Manager API.
Step 1: Retrieve Deployment ID
GET <REDACTED>{orgId}/environments/{envId}/deployments
Step 2: Force Patch to 4.4.x
PATCH .../deployments/{deploymentId}
{
"target": {
"deploymentSettings": {
"runtimeVersion": "4.4.0:20250120-1"
}
}
}
Critical Note: You must revert the project pom.xml and rebuild the JAR with JDK 8/11 before applying this change. The application artifact must be compatible with the target runtime version.
005317653

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.