cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Upgrading sap_java_buildpack to sap_java_buildpack_jakarta

MohanrajV
Discoverer
0 Kudos
232
  • SAP Managed Tags

Hello Friends,

My issue is while trying to upgrade the java build pack from sap_java_buildpack to sap_java_buildpack_jakarta, we are also upgrading our JDK version to 21.

So i changed buildpack specified in manifest.yml file to sap_java_buildpack_jakarta

MohanrajV_8-1744121983888.png

 

And changed in buildpack specified in mta.yaml file to sap_java_buildpack_jakarta

MohanrajV_7-1744121886451.png

 

After compiling my code with Java 21, I deployed a simple HelloWorld servlet to Cloud Foundry. However, upon executing the endpoint, I received a "not found" error. I subsequently reviewed the subaccount-level logs for further insights.

"xxxx/Test has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0 (unable to load class [xxxx.test.Test])","stacktrace":["java.lang.UnsupportedClassVersionError: xxxx/test/Test has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0 (unable to load class [xxxx.test.Test])"

It clearly giving JRE will accept only version 17 only, but my organization has asked to upgrade to Java 21.

I referred this sap help document for upgrading Java to 21
https://help.sap.com/docs/btp/sap-business-technology-platform/sapmachine

SAP mentioned to add below environment variables into manifest.yaml file

MohanrajV_2-1744121397872.png

MohanrajV_6-1744121821372.png

 

if I add and deploy also its giving same error

MohanrajV_5-1744121711853.png

This my pom.xml file

MohanrajV_9-1744122072450.png

 

 

 

 

 
View Entire Topic
MohanrajV
Discoverer
0 Kudos

Hi friends,

I found out the solution,

We have to specify this two below env variables under the
properties tag in the mta.yaml file 

properties:
    JBP_CONFIG_COMPONENTS: "jres: ['com.sap.xs.java.buildpack.jre.SAPMachineJRE']"
    JBP_CONFIG_SAP_MACHINE_JRE: '{ version: 21.+ }'

image.png

 

This is working fine

Best Regards,
Mohanraj V

Ask a Question