From 7db424758f9a3b04bde3dfe6319345049651e617 Mon Sep 17 00:00:00 2001 From: jbonofre Date: Tue, 23 Jun 2020 07:52:00 +0200 Subject: [PATCH] [AMQ-7087] Add JDK 9+ specific JVM args to avoid warnings --- assembly/src/release/bin/activemq | 133 +++++++++++++++--- .../src/release/bin/linux-x86-32/wrapper.conf | 4 + .../src/release/bin/linux-x86-64/wrapper.conf | 4 + assembly/src/release/bin/macosx/wrapper.conf | 4 + assembly/src/release/bin/win32/wrapper.conf | 4 + assembly/src/release/bin/win64/wrapper.conf | 4 + 6 files changed, 131 insertions(+), 22 deletions(-) diff --git a/assembly/src/release/bin/activemq b/assembly/src/release/bin/activemq index 4e86c99ad4..d2cde07ce5 100755 --- a/assembly/src/release/bin/activemq +++ b/assembly/src/release/bin/activemq @@ -323,12 +323,37 @@ invokeJar(){ echo "INFO: changing to user '$ACTIVEMQ_USER' to invoke java" fi + # Get Java version + # Use in priority xpg4 awk or nawk on SunOS as standard awk is outdated + AWK=awk + if ${solaris}; then + if [ -x /usr/xpg4/bin/awk ]; then + AWK=/usr/xpg4/bin/awk + elif [ -x /usr/bin/nawk ]; then + AWK=/usr/bin/nawk + fi + fi + VERSION=`"${JAVACMD}" -version 2>&1 | ${AWK} -F '"' '/version/ {print $2}' | sed -e 's/_.*//g; s/^1\.//g; s/\..*//g; s/-.*//g;'` + # Execute java binary if [ -n "$TASK_TODO" ] && [ "$TASK_TODO" != "stop" ];then if [ -z "$ACTIVEMQ_OUT" ]; then ACTIVEMQ_OUT="/dev/null" fi - $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + if [ "${VERSION}" -gt "8" ]; then + $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + --add-reads=java.xml=java.logging \ + --add-opens java.base/java.security=ALL-UNNAMED \ + --add-opens java.base/java.net=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED \ + --add-opens java.base/java.util=ALL-UNNAMED \ + --add-opens java.naming/javax.naming.spi=ALL-UNNAMED \ + --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED \ + --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED \ + --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED \ -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ @@ -339,30 +364,94 @@ invokeJar(){ RET=\"\$?\"; APID=\"\$!\"; echo \$APID > "${PIDFILE}"; echo \"INFO: pidfile created : '${PIDFILE}' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX - RET="$?" + RET="$?" + else + $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ + -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ + -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ + -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ + -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ + $ACTIVEMQ_CYGWIN \ + -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 & + RET=\"\$?\"; APID=\"\$!\"; + echo \$APID > "${PIDFILE}"; + echo \"INFO: pidfile created : '${PIDFILE}' (pid '\$APID')\";exit \$RET" $DOIT_POSTFIX + RET="$?" + fi elif [ -n "$TASK_TODO" ] && [ "$TASK_TODO" = "stop" ];then SPID="`cat "${PIDFILE}"`" - $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ - -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ - -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ - -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ - -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ - -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ - $ACTIVEMQ_CYGWIN \ - -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID & - RET=\"\$?\"; APID=\"\$!\"; - echo \$APID > "${PIDFILE}.stop"; exit \$RET" $DOIT_POSTFIX - RET="$?" + if [ "${VERSION}" -gt "8" ]; then + $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + --add-reads=java.xml=java.logging \ + --add-opens java.base/java.security=ALL-UNNAMED \ + --add-opens java.base/java.net=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED \ + --add-opens java.base/java.util=ALL-UNNAMED \ + --add-opens java.naming/javax.naming.spi=ALL-UNNAMED \ + --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED \ + --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED \ + --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED \ + -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ + -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ + -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ + -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ + -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ + $ACTIVEMQ_CYGWIN \ + -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID & + RET=\"\$?\"; APID=\"\$!\"; + echo \$APID > "${PIDFILE}.stop"; exit \$RET" $DOIT_POSTFIX + RET="$?" + else + $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ + -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ + -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ + -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ + -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ + $ACTIVEMQ_CYGWIN \ + -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID & + RET=\"\$?\"; APID=\"\$!\"; + echo \$APID > "${PIDFILE}.stop"; exit \$RET" $DOIT_POSTFIX + RET="$?" + fi else - $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ - -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ - -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ - -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ - -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ - -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ - $ACTIVEMQ_CYGWIN \ - -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX - RET="$?" + if [ "${VERSION}" -gt "8" ]; then + $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + --add-reads=java.xml=java.logging \ + --add-opens java.base/java.security=ALL-UNNAMED \ + --add-opens java.base/java.net=ALL-UNNAMED \ + --add-opens java.base/java.lang=ALL-UNNAMED \ + --add-opens java.base/java.util=ALL-UNNAMED \ + --add-opens java.naming/javax.naming.spi=ALL-UNNAMED \ + --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED \ + --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED \ + --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED \ + --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED \ + -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ + -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ + -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ + -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ + -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ + $ACTIVEMQ_CYGWIN \ + -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX + RET="$?" + else + $EXEC_OPTION $DOIT_PREFIX "\"$JAVACMD\" $ACTIVEMQ_OPTS $ACTIVEMQ_DEBUG_OPTS \ + -Dactivemq.classpath=\"${ACTIVEMQ_CLASSPATH}\" \ + -Dactivemq.home=\"${ACTIVEMQ_HOME}\" \ + -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ + -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ + -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ + $ACTIVEMQ_CYGWIN \ + -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX + RET="$?" + fi fi return $RET } diff --git a/assembly/src/release/bin/linux-x86-32/wrapper.conf b/assembly/src/release/bin/linux-x86-32/wrapper.conf index fab6690aab..26a1d870b2 100644 --- a/assembly/src/release/bin/linux-x86-32/wrapper.conf +++ b/assembly/src/release/bin/linux-x86-32/wrapper.conf @@ -24,6 +24,10 @@ set.default.ACTIVEMQ_HOME=../.. set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data + +# if you use JDK 9+, uncomment the following +#set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + wrapper.working.dir=. # Java Application diff --git a/assembly/src/release/bin/linux-x86-64/wrapper.conf b/assembly/src/release/bin/linux-x86-64/wrapper.conf index 7e081e6c89..95e9ec2157 100644 --- a/assembly/src/release/bin/linux-x86-64/wrapper.conf +++ b/assembly/src/release/bin/linux-x86-64/wrapper.conf @@ -24,6 +24,10 @@ set.default.ACTIVEMQ_HOME=../.. set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data + +# if you use JDK 9+, uncomment the following +#set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + wrapper.working.dir=. # Java Application diff --git a/assembly/src/release/bin/macosx/wrapper.conf b/assembly/src/release/bin/macosx/wrapper.conf index 9bc18428f3..215141bb9f 100644 --- a/assembly/src/release/bin/macosx/wrapper.conf +++ b/assembly/src/release/bin/macosx/wrapper.conf @@ -24,6 +24,10 @@ set.default.ACTIVEMQ_HOME=../.. set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data + +# if you use JDK 9+, uncomment the following +#set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + wrapper.working.dir=. # Java Application diff --git a/assembly/src/release/bin/win32/wrapper.conf b/assembly/src/release/bin/win32/wrapper.conf index 7e90df1bbe..9bcd3539de 100644 --- a/assembly/src/release/bin/win32/wrapper.conf +++ b/assembly/src/release/bin/win32/wrapper.conf @@ -24,6 +24,10 @@ set.default.ACTIVEMQ_HOME=../.. set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data + +# if you use JDK 9+, uncomment the following +#set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + wrapper.working.dir=. # Java Application diff --git a/assembly/src/release/bin/win64/wrapper.conf b/assembly/src/release/bin/win64/wrapper.conf index 448ea05f04..4862a059c0 100644 --- a/assembly/src/release/bin/win64/wrapper.conf +++ b/assembly/src/release/bin/win64/wrapper.conf @@ -24,6 +24,10 @@ set.default.ACTIVEMQ_HOME=../.. set.default.ACTIVEMQ_BASE=../.. set.default.ACTIVEMQ_CONF=%ACTIVEMQ_BASE%/conf set.default.ACTIVEMQ_DATA=%ACTIVEMQ_BASE%/data + +# if you use JDK 9+, uncomment the following +#set.JDK_JAVA_OPTIONS=--add-reads=java.xml=java.logging --add-opens java.base/java.security=ALL-UNNAMED --add-opens java.base/java.net=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.naming/javax.naming.spi=ALL-UNNAMED --add-opens java.rmi/sun.rmi.transport.tcp=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.http=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.https=ALL-UNNAMED --add-exports=java.base/sun.net.www.protocol.jar=ALL-UNNAMED --add-exports=jdk.xml.dom/org.w3c.dom.html=ALL-UNNAMED --add-exports=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED + wrapper.working.dir=. # Java Application