spring-cloud-dataflow icon indicating copy to clipboard operation
spring-cloud-dataflow copied to clipboard

JDK 17 passing add-opens as a parameter

Open luf opened this issue 1 year ago • 6 comments

Description: We need to pass --add-opens parameter to batch job applications with SCDF as specified below, but when we pass, it splits parameter with white-space wrongly. https://stackoverflow.com/questions/28327620/difference-between-java-options-java-tool-options-and-java-opts

When we provide below parameter; _JAVA_OPTIONS=--add-opens java.base/java.lang=ALL-UNNAMED

It splits them as two different argument as;

  1. _JAVA_OPTIONS=--add-opens
  2. java.base/java.lang=ALL-UNNAMED

and throws exception for using / character as parameter key.

See; https://stackoverflow.com/questions/74783705/unrecognized-option-add-opens-when-passed-with-java-options

Release versions: 2.11.4

All known escaping methods have been tried, (backslash, backslash+double-quote, double-quote, double single-quote etc)

Since each batch application may have different module openings with Java 17, do you have any guidance on how to specify the application specifically?

luf avatar Dec 30 '24 07:12 luf

Which platform are you using? Local, Local-Docker, Kubernetes or Cloud Foundry?

corneil avatar Dec 30 '24 08:12 corneil

Sorry I missed to mention it; Kubernetes

luf avatar Dec 30 '24 08:12 luf

@luf How are you passing the configured the values?

If you put double quotes around the value it should be treated as one and not split. e.g. _JAVA_OPTIONS="--add-opens java.base/java.lang=ALL-UNNAMED"

corneil avatar Dec 30 '24 08:12 corneil

@luf Do you want to set this for all applications launched or just a specific application?

corneil avatar Dec 30 '24 08:12 corneil

@corneil with the Kubernetes, we need to pass all arguments as a single String, so it need to be written with escape character, and below methods doesnt work parameters="someOption=someValue _JAVA_OPTIONS=backslash"--add-opens java.base/java.lang=ALL-UNNAMED backslash" " parameters="someOption=someValue _JAVA_OPTIONS='--add-opens java.base/java.lang=ALL-UNNAMED' " parameters="someOption=someValue _JAVA_OPTIONS=--add-opens java.base/java.lang=ALL-UNNAMED "

Just a specific application

luf avatar Dec 30 '24 08:12 luf

Have a look at https://docs.spring.io/spring-cloud-dataflow/docs/current/reference/htmlsingle/#_environment_variables

corneil avatar Dec 30 '24 08:12 corneil