Error 'Unrecognized Options --add-opens' when vFunction Agent added to a Java Springboot Application running Java 17


Overview of the Issue

This issue occurs in the following circumstances:

  1. An organization installs the VF Agent on a Java Springboot Application that uses Java 11 or 17
  2. The following is printed in the Application’s logging
Picked up JAVA_TOOL_OPTIONS: -agentpath:/shared/vfunction/vfunction/opt/vfunction/agent/libJVMTIAgent.so -javaagent:/shared/vfunction/opt/vfunction/agent/runtime-agent.jar –-add-opens java.base/java.lang=ALL-UNNAMED -Dcom.vfunction.instance=default-java
Unrecognized option: --add-opens
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.


Steps to Resolve the Issue

  1. Modify the string used for the JAVA_TOOL_OPTIONS to add an Equals sign
### AFTER
–-add-opens=java.base/java.lang=ALL-UNNAMED

### BEFORE
–-add-opens java.base/java.lang=ALL-UNNAMED

sed -i 's~#tracking_conf~tracking_conf~g' $BASE_DIR/vfunction/etc/sysconfig/vfunction/agent/instances/$INSTANCE/native-conf.json
  1. Restart the Application