Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-16703

Server startup script consults java from PATH instead of configured JAVA or JAVA_HOME for version consultation

XMLWordPrintable

    • Hide
      [rhusar@puglia infinispan-server-14.0.31.Final]$ echo $PATH
      /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin:...
      [rhusar@puglia infinispan-server-14.0.31.Final]$ echo $JAVA_HOME
      /Library/Java/JavaVirtualMachines/temurin-23.jdk/Contents/Home
      [rhusar@puglia infinispan-server-14.0.31.Final]$ ./bin/server.sh
      
      2024-10-01 19:30:41,967 INFO  (main) [BOOT] JVM OpenJDK 64-Bit Server VM Eclipse Adoptium 23+37
      2024-10-01 19:30:41,970 INFO  (main) [BOOT] JVM arguments = [-server, -Xlog:gc*:file=/Users/rhusar/STATIC/infinispan/infinispan-server-14.0.31.Final/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Xms64m, -Xmx512m, -XX:MetaspaceSize=64M, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.infinispan.server.loader.LogManager, -Dinfinispan.server.home.path=/Users/rhusar/STATIC/infinispan/infinispan-server-14.0.31.Final, -classpath, :/Users/rhusar/STATIC/infinispan/infinispan-server-14.0.31.Final/boot/infinispan-server-runtime-14.0.31.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap]
      2024-10-01 19:30:41,971 INFO  (main) [BOOT] PID = 36505
      ...
      Caused by: java.lang.UnsupportedOperationException: getSubject is supported only if a security manager is allowed
      
      Show
      [rhusar@puglia infinispan-server-14.0.31.Final]$ echo $PATH /Library/Java/JavaVirtualMachines/temurin-8.jdk/Contents/Home/bin:... [rhusar@puglia infinispan-server-14.0.31.Final]$ echo $JAVA_HOME /Library/Java/JavaVirtualMachines/temurin-23.jdk/Contents/Home [rhusar@puglia infinispan-server-14.0.31.Final]$ ./bin/server.sh 2024-10-01 19:30:41,967 INFO (main) [BOOT] JVM OpenJDK 64-Bit Server VM Eclipse Adoptium 23+37 2024-10-01 19:30:41,970 INFO (main) [BOOT] JVM arguments = [-server, -Xlog:gc*:file=/Users/rhusar/STATIC/infinispan/infinispan-server-14.0.31.Final/server/log/gc.log:time,uptimemillis:filecount=5,filesize=3M, -Xms64m, -Xmx512m, -XX:MetaspaceSize=64M, -Djava.net.preferIPv4Stack=true, -Djava.awt.headless=true, -Dvisualvm.display.name=infinispan-server, -Djava.util.logging.manager=org.infinispan.server.loader.LogManager, -Dinfinispan.server.home.path=/Users/rhusar/STATIC/infinispan/infinispan-server-14.0.31.Final, -classpath, :/Users/rhusar/STATIC/infinispan/infinispan-server-14.0.31.Final/boot/infinispan-server-runtime-14.0.31.Final-loader.jar, org.infinispan.server.loader.Loader, org.infinispan.server.Bootstrap] 2024-10-01 19:30:41,971 INFO (main) [BOOT] PID = 36505 ... Caused by: java.lang.UnsupportedOperationException: getSubject is supported only if a security manager is allowed

      This is problematic when PATH does not reflect the configured JAVA_HOME.

      This results in the following properties missing when there is an older default java version on the system.

          JAVA_VERSION=$(java -version 2>&1 | sed -n ';s/.* version "\([^\.\-]*\).*".*/\1/p;')
          if [ "$JAVA_VERSION" -ge 17 ]; then
              # Enable export for LDAP (needed for JDK 17+)
              PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS --add-exports java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.util.concurrent=ALL-UNNAMED"
          fi
      
          if [ "$JAVA_VERSION" -ge 18 ]; then
              # Change back default value of java.security.manager (needed for JDK 18+)
              PREPEND_JAVA_OPTS="$PREPEND_JAVA_OPTS -Djava.security.manager=allow"
          fi
      

              rhn-engineering-rhusar Radoslav Husar
              rhn-engineering-rhusar Radoslav Husar
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: