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

[RHEL 7 RPM] Tomcat does not properly parse spaces in JVM parameters/settings

XMLWordPrintable

    • 2
    • 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.

      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):
      JWS 3.1.0: tomcat7-7.0.70-16.ep7.el7.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' -XX:+PrintFlagsFinal"
      

      3. Restart the application

      Actual results:

      Tomcat starts with:

      [root@rhel7 ~]# systemctl start tomcat7
      [root@rhel7 ~]# systemctl status tomcat7
      ● tomcat7.service - Apache Tomcat Web Application Container
         Loaded: loaded (/usr/lib/systemd/system/tomcat7.service; disabled; vendor preset: disabled)
         Active: failed (Result: exit-code) since Thu 2017-02-23 09:38:37 EST; 2s ago
        Process: 3039 ExecStart=/usr/libexec/tomcat7/server start (code=exited, status=1/FAILURE)
       Main PID: 3039 (code=exited, status=1/FAILURE)
      
      Feb 23 09:38:37 rhel7 server[3039]: Java virtual machine used: /usr/lib/jvm/jre/bin/java
      Feb 23 09:38:37 rhel7 server[3039]: classpath used: /usr/share/tomcat7/bin/bootstrap.jar:/usr/share/tomcat7/bin/tomcat-juli.jar:
      Feb 23 09:38:37 rhel7 server[3039]: main class used: org.apache.catalina.startup.Bootstrap
      Feb 23 09:38:37 rhel7 server[3039]: flags used: -XX:HeapDumpPath='/tmp/foo bar biz bang.heapdump' -XX:+PrintFlagsFinal
      Feb 23 09:38:37 rhel7 server[3039]: options used: -Dcatalina.base=/usr/share/tomcat7 -Dcatalina.home=/usr/share/tomcat7 -Djava.endorsed.dirs= -Djava.io.tmpdir=/var/cache/tomcat7/temp -Djava.uti...oaderLogManager
      Feb 23 09:38:37 rhel7 server[3039]: arguments used: start
      Feb 23 09:38:37 rhel7 server[3039]: Error: Could not find or load main class bar
      Feb 23 09:38:37 rhel7 systemd[1]: tomcat7.service: main process exited, code=exited, status=1/FAILURE
      Feb 23 09:38:37 rhel7 systemd[1]: Unit tomcat7.service entered failed state.
      Feb 23 09:38:37 rhel7 systemd[1]: tomcat7.service failed.
      Hint: Some lines were ellipsized, use -l to show in full.
      

      Expected results:

      Tomcat should start without an issue and dump a list of all JVM flags to stdout (which you can check with journalctl -u tomcat7).

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

      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)
      

            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

              Created:
              Updated:
              Resolved: