I run a Spring Cloud Data Flow server on Cloudfoundry (Swisscom). I'm able to properly register a task (Spring Boot), but the task fails to start because of the wrong java runtime being used:
2019-08-26T11:30:41.57+0200 [APP/TASK/t1-x/0] OUT JVM Memory Configuration: -Xmx435467K -Xss1M -XX:ReservedCodeCacheSize=240M -XX:MaxDirectMemorySize=10M -XX:MaxMetaspaceSize=101108K
2019-08-26T11:30:41.80+0200 [APP/TASK/t1-x/0] ERR Exception in thread "main" java.lang.UnsupportedClassVersionError: ch/xxx/task1/Task1Application has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
2019-08-26T11:30:41.80+0200 [APP/TASK/t1-x/0] ERR at java.lang.ClassLoader.defineClass1(Native Method)
Sure this is caused by the cloudfoundry java_buildpack not using the correct java version. Usually this is easy to fix, I just pass the following env variable while deploying the application:
JBP_CONFIG_OPEN_JDK_JRE: '{jre: { version: 11.+ }}'
but how do I do this when SCDF is deploying the taks-application? I know there is a parameter deployer.cloudfoundry.buildpack=java_buildpack
which I can use when I start the task, but how can I pass arguments/environment variables to the buildpack?
Update:
as for now, there are two open issues regarding this issue:
JBP_CONFIG_OPEN_JDK_JRE
, that way the env variable is set when the Java buildpack runs. I looked through the docs and didn't see a way to do this for Cloud Foundry. You could alwayscf set-env
and update it after the fact, then restage your app but that's definitely not a nice user experience. – Daniel Mikusa