Java Migration Analysis

The last feature we will describe is Java migration analysis, which allows you to generate report about your application readiness to migrate to newer version of JDK. All Oracle LTS Java releases are supported along with last released Oracle JDK. The report of the analysis will provide you effort and risk associated with switching to desired JDK major version.

Note:

Application analysis is done on managed instance, additional resources are consumed during analysis.

OCI Cloud Console

  1. Sign in to the OCI Console as an administrator.
  2. Open the navigation menu, click Observability & Management, and then click Fleets under Java Management.
  3. Select your fleet.
  4. Click Managed instances and then click on the managed instance where the application is running.
  5. Click Applications and select the application on which the Java Migration analysis should be started.
  6. Click Actions and select Start Java migration analysis.
  7. Click Start.
  8. Once the work request is finished, click on the work request and in details navigate to the Java migration analysis files located in your fleet's bucket.

OCI CLI

  1. Create targets payload template using the following command:
    ci jms fleet request-java-migration-analyses --generate-param-json-input
        targets
  2. Find details about your application, for example with:
    oci jms application-installation-usage-summary summarize-application-installation-usage
          --display-name-contains $APP_NAME --fleet-id $FLEET_OCID
  3. Edit the payload json file, for example:
    [
      {
        "applicationInstallationKey": "$APP_INSTALL_KEY",
        "managedInstanceId": "$MANAGED_INSTANCE_OCID",
        "sourceJdkVersion": "$CURRENT_MAJOR_JAVA_RUNTIME_VERSION_USED_BY_APP",
        "targetJdkVersion": "$NEXT_JAVA_VERSION"
      }
    ]
  4. Execute the following command:
    oci jms fleet request-java-migration-analyses --fleet-id $FLEET_OCID --targets
          file://target.json

Example

The purpose of the JMS migration analysis is straightforward: to help migrate your application to a more recent Java version. In this example, we will take a simple Java 8 application, and we would like to know in what areas we need to invest our effort to make the application run on Java 21:
#!/usr/bin/env bash
 
# configuration variables
APP_NAME=JMigrateExampleApp
FLEET_OCID=ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta
MANAGED_INSTANCE_OCID=ocid1.instance.oc1.eu-frankfurt-1.antheljtptiaquqcrjmnu7mxbjthm2jm5qzryu7xy4w27rfo56nxf4uwv6pq
CURRENT_MAJOR_JAVA_RUNTIME_VERSION_USED_BY_APP=1.8
NEXT_JAVA_VERSION=21
 
# get application installation key
APP_INSTALL_KEY=$(oci jms application-installation-usage-summary summarize-application-installation-usage --display-name-contains $APP_NAME --fleet-id $FLEET_OCID | jq -r '.data.items[]."application-installation-key"')
 
# JMigrate payload
cat > jmigrate-payload.json << EOF
[
  {
    "applicationInstallationKey": "$APP_INSTALL_KEY",
    "managedInstanceId": "$MANAGED_INSTANCE_OCID",
    "sourceJdkVersion": "$CURRENT_MAJOR_JAVA_RUNTIME_VERSION_USED_BY_APP",
    "targetJdkVersion": "$NEXT_JAVA_VERSION"
  }
]
EOF
 
# start java migration analysis on specified managed instance
WORK_REQUEST_OCID=$(oci jms fleet request-java-migration-analyses \
    --fleet-id "$FLEET_OCID" \
    --targets file://jmigrate-payload.json | jq -r '."opc-work-request-id"')
 
echo $WORK_REQUEST_OCID
rm jmigrate-payload.json
  
# additionally, you can add your own logic to check if work request is finished
# sleep 600
# oci jms work-request get --work-request-id "$WORK_REQUEST_OCID" | jq .data.status

Once the JMigrate work request is successfully finished, we can find the report in JMS and show its content with the following statements:

#!/usr/bin/env bash
 
# configuration variables
FLEET_OCID=ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta
WORK_REQUEST_OCID=ocid1.jmsworkrequest.oc1.eu-frankfurt-1.aaaaaaaapqrtnlvfyltloscefazwuuoyd6pdqpsmaxfnirregqirx3b7jbva
 
# get the analysis id, there can be multiple ids but, in our example, we expect just one
ANALYSIS_OCID=$(oci jms java-migration-analysis-result list --fleet-id $FLEET_OCID --sort-by timeCreated --sort-order DESC | jq -r ".data.items[] | select(.\"work-request-id\"==\"$WORK_REQUEST_OCID\") | .id")
 
# See the result
oci jms java-migration-analysis-result get --fleet-id $FLEET_OCID --java-migration-analysis-result-id $ANALYSIS_OCID
{
  "data": {
    "application-execution-type": "INSTALLED",
    "application-key": "38d3d5b89e9e42da00c5be9bdbee216a0e297c2ea942330e5af4051c4951b50a",
    "application-name": "JmigrateExample.jar",
    "application-path": "/home/opc/JmigrateExample.jar",
    "bucket-name": "jms_ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta",
    "fleet-id": "ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta",
    "host-name": "jms-demo",
    "id": "ocid1.jmsreport.oc1.eu-frankfurt-1.amaaaaaalzyjypyaa4puer7qtjn2s3zih55ir5jzma4lyiulxpy7qn3xtbhq",
    "managed-instance-id": "ocid1.instance.oc1.eu-frankfurt-1.antheljtptiaquqcrjmnu7mxbjthm2jm5qzryu7xy4w27rfo56nxf4uwv6pq",
    "metadata": null,
    "namespace": "frmss8xk2qta",
    "object-list": [
      "diagsbyapi-summary-counts.json",
      "diagsbyclass-p3.json",
      "diagsbyapi-p1.json",
      "diagsbyclass-p4.json",
      "JmigrateExample.jar.zip",
      "diagsbyclass-p1.json",
      "diagsbyapi-p4.json",
      "diagsbyapi-p4-summary.json",
      "execsummary.json",
      "diagsbyapi-p3-summary.json",
      "diagsbyapi-p1-summary.json",
      "diagsbyapi-p2-summary.json",
      "diagsbyapi-p2.json",
      "jarsummaries-without-classsummaries.json",
      "diagsbyapi-p3.json",
      "diagsbyclass-summary-counts.json",
      "diagsbyclass-p2.json"
    ],
    "object-storage-upload-dir-path": "JMS/JAVA_MIGRATION/ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta/ocid1.instance.oc1.eu-frankfurt-1.antheljtptiaquqcrjmnu7mxbjthm2jm5qzryu7xy4w27rfo56nxf4uwv6pq/2025-07-09T14:33:49.750Z_ocid1.jmsworkrequest.oc1.eu-frankfurt-1.aaaaaaaapqrtnlvfyltloscefazwuuoyd6pdqpsmaxfnirregqirx3b7jbva_JmigrateExample.jar/7adcab9b-1556-443d-9a86-a41f3e5bbb45/",
    "source-jdk-version": "1.8",
    "target-jdk-version": "21",
    "time-created": "2025-07-09T14:41:16.353000+00:00",
    "work-request-id": "ocid1.jmsworkrequest.oc1.eu-frankfurt-1.aaaaaaaapqrtnlvfyltloscefazwuuoyd6pdqpsmaxfnirregqirx3b7jbva"
  }
}

Analysis data is stored in the Object storage service and can be reached by taking data from the analysis result, for example namespace, bucket-name is provided, then there is a list of files defined inside object-list and for each file we can get the path by concatenating the object-storage-upload-dir-path and item from the object-list.

oci os object get --bucket-name jms_ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta --name JMS/JAVA_MIGRATION/ocid1.jmsfleet.oc1.eu-frankfurt-1.amaaaaaaptiaquqa2qxxkco6hrguz7nyug2hcpgikhe5gz4d7uy6j6ilbtta/ocid1.instance.oc1.eu-frankfurt-1.antheljtptiaquqcrjmnu7mxbjthm2jm5qzryu7xy4w27rfo56nxf4uwv6pq/2025-07-09T14:33:49.750Z_ocid1.jmsworkrequest.oc1.eu-frankfurt-1.aaaaaaaapqrtnlvfyltloscefazwuuoyd6pdqpsmaxfnirregqirx3b7jbva_JmigrateExample.jar/7adcab9b-1556-443d-9a86-a41f3e5bbb45/jarsummaries-without-classsummaries.json --file -
 
[ {
  "url" : "jar:file:/home/opc/JmigrateExample.jar",
  "archiveType" : "JAR",
  "classCount" : 3,
  "classesWithDiagnosticsCount" : 3,
  "p1Count" : 31,
  "totalDiagnosticsCount" : 31
} ]%

For better user experience, we recommend using the OCI JMS Cloud console, where the report is nicely rendered to provide all necessary details about migration.