Uploaded image for project: 'JBoss Web Server'
  1. JBoss Web Server
  2. JWS-401

Tomcat does not properly parse spaces in JVM parameters/settings

    XMLWordPrintable

Details

    • Release Notes
    • Hide
      Tomcat fails to start when using JAVA_OPTS which have spaces in them.

      This is a known issue in JBoss Web Server 3.1.0.
      Show
      Tomcat fails to start when using JAVA_OPTS which have spaces in them. This is a known issue in JBoss Web Server 3.1.0.
    • Workaround Exists
    • Hide

      You need to use "" wrappings in the init script.

      Show
      You need to use "" wrappings in the init script.

    Description

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

      Attachments

        Issue Links

          Activity

            People

              rhn-support-csutherl Coty Sutherland
              rhn-support-edrich Eric Rich
              Jan Onderka Jan Onderka
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: