[AMQ-9126] Set jolokia.conf sys prop and escape cleanly on Windows platform

This commit is contained in:
Jean-Baptiste Onofré 2022-11-28 18:41:55 +01:00
parent a530142fd5
commit 49626f07b6
3 changed files with 19 additions and 2 deletions

View File

@ -125,6 +125,11 @@ if [ -z "$ACTIVEMQ_CONF" ] ; then
fi fi
fi fi
# Jolokia configuration
if [ -z "$JOLOKIA_CONF" ] ; then
JOLOKIA_CONF=file:$ACTIVEMQ_CONF/jolokia-access.xml
fi
# Configure a user with non root privileges, if no user is specified do not change user # Configure a user with non root privileges, if no user is specified do not change user
if [ -z "$ACTIVEMQ_USER" ] ; then if [ -z "$ACTIVEMQ_USER" ] ; then
ACTIVEMQ_USER="" ACTIVEMQ_USER=""
@ -267,6 +272,7 @@ if [ "$OSTYPE" = "cygwin" ];then
ACTIVEMQ_BASE="`cygpath --windows "$ACTIVEMQ_BASE"`" ACTIVEMQ_BASE="`cygpath --windows "$ACTIVEMQ_BASE"`"
ACTIVEMQ_CONF="`cygpath --windows "$ACTIVEMQ_CONF"`" ACTIVEMQ_CONF="`cygpath --windows "$ACTIVEMQ_CONF"`"
ACTIVEMQ_DATA="`cygpath --windows "$ACTIVEMQ_DATA"`" ACTIVEMQ_DATA="`cygpath --windows "$ACTIVEMQ_DATA"`"
JOLOKIA_CONF="`cygpath --windows "$JOLOKIA_CONF"`"
ACTIVEMQ_CLASSPATH=`cygpath --path --windows "$ACTIVEMQ_CLASSPATH"` ACTIVEMQ_CLASSPATH=`cygpath --path --windows "$ACTIVEMQ_CLASSPATH"`
[ -n "$JAVA_HOME" ] && [ -n "$JAVA_HOME" ] &&
JAVA_HOME="`cygpath --windows "$JAVA_HOME"`" JAVA_HOME="`cygpath --windows "$JAVA_HOME"`"
@ -288,6 +294,7 @@ if [ "$OSTYPE" = "cygwin" ];then
ACTIVEMQ_BASE="`echo ${ACTIVEMQ_BASE}|sed '~s,[\\]*$,,g'`" ACTIVEMQ_BASE="`echo ${ACTIVEMQ_BASE}|sed '~s,[\\]*$,,g'`"
ACTIVEMQ_CONF="`echo ${ACTIVEMQ_CONF}|sed '~s,[\\]*$,,g'`" ACTIVEMQ_CONF="`echo ${ACTIVEMQ_CONF}|sed '~s,[\\]*$,,g'`"
ACTIVEMQ_DATA="`echo ${ACTIVEMQ_DATA}|sed '~s,[\\]*$,,g'`" ACTIVEMQ_DATA="`echo ${ACTIVEMQ_DATA}|sed '~s,[\\]*$,,g'`"
JOLOKIA_CONF="`echo ${JOLOKIA_CONF}|sed '~s,[\\]*$,,g'`"
fi fi
# Start the ActiveMQ JAR # Start the ActiveMQ JAR
@ -361,6 +368,7 @@ invokeJar(){
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
-Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
-Djolokia.conf=\"${JOLOKIA_CONF}\" \
$ACTIVEMQ_CYGWIN \ $ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 & -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 &
RET=\"\$?\"; APID=\"\$!\"; RET=\"\$?\"; APID=\"\$!\";
@ -374,6 +382,7 @@ invokeJar(){
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
-Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
-Djolokia.conf=\"${JOLOKIA_CONF}\" \
$ACTIVEMQ_CYGWIN \ $ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 & -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS >> $ACTIVEMQ_OUT 2>&1 &
RET=\"\$?\"; APID=\"\$!\"; RET=\"\$?\"; APID=\"\$!\";
@ -404,6 +413,7 @@ invokeJar(){
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
-Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
-Djolokia.conf=\"${JOLOKIA_CONF}\" \
$ACTIVEMQ_CYGWIN \ $ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID & -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID &
RET=\"\$?\"; APID=\"\$!\"; RET=\"\$?\"; APID=\"\$!\";
@ -416,6 +426,7 @@ invokeJar(){
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
-Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
-Djolokia.conf=\"${JOLOKIA_CONF}\" \
$ACTIVEMQ_CYGWIN \ $ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID & -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS --pid $SPID &
RET=\"\$?\"; APID=\"\$!\"; RET=\"\$?\"; APID=\"\$!\";
@ -444,6 +455,7 @@ invokeJar(){
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
-Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
-Djolokia.conf=\"${JOLOKIA_CONF}\" \
$ACTIVEMQ_CYGWIN \ $ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX
RET="$?" RET="$?"
@ -454,6 +466,7 @@ invokeJar(){
-Dactivemq.base=\"${ACTIVEMQ_BASE}\" \ -Dactivemq.base=\"${ACTIVEMQ_BASE}\" \
-Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \ -Dactivemq.conf=\"${ACTIVEMQ_CONF}\" \
-Dactivemq.data=\"${ACTIVEMQ_DATA}\" \ -Dactivemq.data=\"${ACTIVEMQ_DATA}\" \
-Djolokia.conf=\"${JOLOKIA_CONF}\" \
$ACTIVEMQ_CYGWIN \ $ACTIVEMQ_CYGWIN \
-jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX -jar \"${ACTIVEMQ_HOME}/bin/activemq.jar\" $COMMANDLINE_ARGS" $DOIT_POSTFIX
RET="$?" RET="$?"

View File

@ -92,7 +92,11 @@ REM Setup ActiveMQ Classpath.
REM Add instance conf dir before AMQ install conf dir to pick up instance-specific classpath entries first REM Add instance conf dir before AMQ install conf dir to pick up instance-specific classpath entries first
set ACTIVEMQ_CLASSPATH=%ACTIVEMQ_CONF%;%ACTIVEMQ_BASE%/conf;%ACTIVEMQ_HOME%/conf;%ACTIVEMQ_CLASSPATH% set ACTIVEMQ_CLASSPATH=%ACTIVEMQ_CONF%;%ACTIVEMQ_BASE%/conf;%ACTIVEMQ_HOME%/conf;%ACTIVEMQ_CLASSPATH%
"%_JAVACMD%" %ACTIVEMQ_SUNJMX_START% %ACTIVEMQ_DEBUG_OPTS% %ACTIVEMQ_OPTS% %ACTIVEMQ_SSL_OPTS% -Dactivemq.classpath="%ACTIVEMQ_CLASSPATH%" -Dactivemq.home="%ACTIVEMQ_HOME%" -Dactivemq.base="%ACTIVEMQ_BASE%" -Dactivemq.conf="%ACTIVEMQ_CONF%" -Dactivemq.data="%ACTIVEMQ_DATA%" -Djava.io.tmpdir="%ACTIVEMQ_TMP%" -jar "%ACTIVEMQ_HOME%/bin/activemq.jar" %* REM Setup jolokia-access.xml path by doubling the \\
if "%JOLOKIA_CONF%" == "" set JOLOKIA_CONF=file:%ACTIVEMQ_CONF%\jolokia-access.xml
set JOLOKIA_CONF=%JOLOKIA_CONF:\=\\%
"%_JAVACMD%" %ACTIVEMQ_SUNJMX_START% %ACTIVEMQ_DEBUG_OPTS% %ACTIVEMQ_OPTS% %ACTIVEMQ_SSL_OPTS% -Dactivemq.classpath="%ACTIVEMQ_CLASSPATH%" -Dactivemq.home="%ACTIVEMQ_HOME%" -Dactivemq.base="%ACTIVEMQ_BASE%" -Dactivemq.conf="%ACTIVEMQ_CONF%" -Dactivemq.data="%ACTIVEMQ_DATA%" -Djolokia.conf="%JOLOKIA_CONF%" -Djava.io.tmpdir="%ACTIVEMQ_TMP%" -jar "%ACTIVEMQ_HOME%/bin/activemq.jar" %*
goto end goto end

View File

@ -55,7 +55,7 @@
--> -->
<init-param> <init-param>
<param-name>policyLocation</param-name> <param-name>policyLocation</param-name>
<param-value>file:${prop:activemq.conf}/jolokia-access.xml</param-value> <param-value>${prop:jolokia.conf}</param-value>
</init-param> </init-param>
<!-- turn off returning exceptions and stacktraces from jolokia --> <!-- turn off returning exceptions and stacktraces from jolokia -->
<init-param> <init-param>