+++ This bug was initially created as a clone of Bug #1282850 +++ Description of problem: The Tomcat start scripts do not seem to parse or processes JVM values that contain spaces correctly. Version-Release number of selected component (if applicable): 2.2 and Online How reproducible: 100% Steps to Reproduce: 1. Create a tomcat application 2. Set an env loaded by the JVM (that contains a space) $ --> rhc env set JAVA_OPTS_EXT="-Dworking.dir=app-root/data/test dir" -a APP_NAME 3. Restart the application Actual results: Tomcat starts with: INFO: Destroying ProtocolHandler ["http-bio-127.11.58.1-8080"] Error: Could not find or load main class dir Expected results: Tomcat should start without an issue. Additional info: Using various "", '' {quoting structures) or \ {escape characters} do not seem to enable the ability to load environment variables with spaces in them (to the JVM). JAVA_OPTS_EXT="-Dworking.dir=app-root/data/test\ dir" However the following patch can be used to see where the potential issue might be: --- /usr/sbin/tomcat7 2015-11-17 10:40:10.659042048 -0500 ### or the tomcat script from the cartridge. +++ - 2015-11-17 10:40:29.326768849 -0500 @@ -24,7 +24,7 @@ CLASSPATH="${CLASSPATH}:$(build-classpath commons-daemon 2>/dev/null)" if [ "$1" = "start" ]; then - ${JAVACMD} $JAVA_OPTS $LOGGING_CONFIG $CATALINA_OPTS \ + ${JAVACMD} "$JAVA_OPTS" $LOGGING_CONFIG $CATALINA_OPTS \ -classpath "$CLASSPATH" \ -Dcatalina.base="$CATALINA_BASE" \ -Dcatalina.home="$CATALINA_HOME" \ It should be noted that "spaces" in JVM parameters are possible, however they do not seem to be possible in the Tomcat EWS start scripts. # java -XX:HeapDumpPath="/tmp/foo bar biz bang.heapdump" -version openjdk version "1.8.0_65" OpenJDK Runtime Environment (build 1.8.0_65-b17) OpenJDK 64-Bit Server VM (build 25.65-b01, mixed mode)
Hi, I currently have a PR to improve the tomcat script to handle the white spaces. However, it's still required to have double quote encapsulating the directory which contains the white spaces. So, the correct env var setup command should be: rhc env set JAVA_OPTS_EXT='-Dworking.dir="app-root/data/test dir"' -a APP_NAME Thanks, Vu
Commit pushed to master at https://github.com/openshift/origin-server https://github.com/openshift/origin-server/commit/7a0be7537cc5ce7b2749bca5a19a64f62cb97f6c Tomcat does not properly parse spaces in JVM parameters Tomcat script doesn't correct handle the white places in the parameters passing via env variable JAVA_OPTS_EXT which causes the JVM fails to parse the parameters correctly during execution. The tomcat bash script is modified to handle the white spaces and ensured the space is not ignored by adding the extra double quotes around the "JAVA_OPTS_EXT". Bug: 1282852 Link: <https://bugzilla.redhat.com/show_bug.cgi?id=1282852> Signed-off-by: Vu Dinh <vdinh>
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://rhn.redhat.com/errata/RHSA-2016-1773.html