cloudfoundry / java-buildpack

Cloud Foundry buildpack for running Java applications
Apache License 2.0
433 stars 2.59k forks source link

Wrong SAPMachine Version during Deployment to SAP BTP #1054

Closed Queenhymon closed 5 months ago

Queenhymon commented 5 months ago

Context: We are trying to deploy a Java Spring Boot CAP application to deploy to BTP. During deployment we getting an issue with the SAPMachine Java version. (buildpack sap_java_buildpack is not working with service binding to PostgresDB, instead we use java_buildpack as advised by SAP)

Log: Downloading Sap Machine JRE from https://github.com/SAP/SapMachine/releases/download/**sapmachine-11.0.21**/sapmachine-jre-11.0.21_linux-x64_bin.tar.gz

We are expecting Sap Machine version 17 as configured: JBP_CONFIG_SAP_MACHINE_JRE: '{ use_offline_repository: false, version: 17.+ }' parameters: buildpack: java_buildpack properties: SPRING_PROFILES_ACTIVE: cloud,sandbox JBP_CONFIG_COMPONENTS: "{jres: ['JavaBuildpack::Jre::SapMachineJRE']}" JBP_CONFIG_OPEN_JDK_JRE: "{ jre: { version: 17.+ }}" JBP_CONFIG_SAP_MACHINE_JRE: '{ use_offline_repository: false, version: 17.+ }'

Error on BTP in the logs: java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/JarLauncher has been compiled by a more recent version of the Java Runtime (class file version 61.0), this version of the Java Runtime only recognizes class file versions up to 55.0

pivotal-david-osullivan commented 5 months ago

I think the problem is your configuration env variable for SAP JRE.

It should be structured the same as the Open JDK one:

JBP_CONFIG_SAP_MACHINE_JRE '{ jre: { version: 17.+ }}'

Queenhymon commented 5 months ago

Thank you so much for the quick response! It works now :)