Bug 1282850 - Tomcat Does not properly parse spaces in JVM parameters/setttings
Summary: Tomcat Does not properly parse spaces in JVM parameters/setttings
Keywords:
Status: CLOSED DEFERRED
Alias: None
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: tomcat7
Version: 2.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: ---
Assignee: Coty Sutherland
QA Contact: Jan Stefl
URL:
Whiteboard:
Depends On:
Blocks: 1282852
TreeView+ depends on / blocked
 
Reported: 2015-11-17 15:55 UTC by Eric Rich
Modified: 2019-10-10 10:30 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1282852 (view as bug list)
Environment:
Last Closed: 2017-08-09 16:23:20 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker JWS-401 0 Major Closed Tomcat does not properly parse spaces in JVM parameters/settings 2018-11-27 09:49:31 UTC

Description Eric Rich 2015-11-17 15:55:30 UTC
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): 
    EWS 2: tomcat7-7.0.54-19_patch_04.ep6.el6.noarch

How reproducible: 100%

Steps to Reproduce:
1. Install Tomcat7
2. Set an env loaded by the JVM (that contains a space) in /etc/sysconfig/tomcat7
    JAVA_OPTS="-XX:HeapDumpPath='/tmp/foo bar biz bang.heapdump' -version"
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 bar

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). 

However the following patch can be used to see where the potental 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 paramiters 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)

Comment 1 Michal Karm Babacek 2016-03-31 17:44:24 UTC
Pending triage...


Note You need to log in before you can comment on or make changes to this bug.