Bug 1282850 - Tomcat Does not properly parse spaces in JVM parameters/setttings
Tomcat Does not properly parse spaces in JVM parameters/setttings
Product: JBoss Enterprise Web Server 2
Classification: JBoss
Component: tomcat7 (Show other bugs)
Unspecified Unspecified
unspecified Severity high
: ---
: ---
Assigned To: Coty Sutherland
Jan Stefl
Depends On:
Blocks: 1282852
  Show dependency treegraph
Reported: 2015-11-17 10:55 EST by Eric Rich
Modified: 2017-08-09 12:23 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 1282852 (view as bug list)
Last Closed: 2017-08-09 12:23:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
JBoss Issue Tracker JWS-401 Major Closed Tomcat does not properly parse spaces in JVM parameters/settings 2018-02-27 07:51 EST

  None (edit)
Description Eric Rich 2015-11-17 10:55:30 EST
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-"]
    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
     -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 13:44:24 EDT
Pending triage...

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