[Bug 1002662] New: Tomcat Lacks "setenv.sh" Implementation
http://bugzilla.novell.com/show_bug.cgi?id=1002662 Bug ID: 1002662 Summary: Tomcat Lacks "setenv.sh" Implementation Classification: openSUSE Product: openSUSE Distribution Version: Leap 42.2 Hardware: Other OS: SLES 12 Status: NEW Severity: Major Priority: P5 - None Component: Other Assignee: bnc-team-screening@forge.provo.novell.com Reporter: adam.jerome@microfocus.com QA Contact: qa-bugs@suse.de CC: adam.jerome@microfocus.com Depends on: 1002639 Found By: --- Blocker: --- +++ This bug was initially created as a clone of Bug #1002639 +++ Inconsistency in the openSUSE implementation of tomcat. To help identify this inconsistency, I will quote a section from the upstream documentation https://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt : ++++++++++++++++++++ Begin Quote +++++++++++++++++++++++++++++++++ (3.4) Using the "setenv" script (optional, recommended) Apart from CATALINA_HOME and CATALINA_BASE, all environment variables can be specified in the "setenv" script. The script is placed either into CATALINA_BASE/bin or into CATALINA_HOME/bin directory and is named setenv.bat (on Windows) or setenv.sh (on *nix). The file has to be readable. By default the setenv script file is absent. If the script file is present both in CATALINA_BASE and in CATALINA_HOME, the one in CATALINA_BASE is preferred. For example, to configure the JRE_HOME and CATALINA_PID variables you can create the following script file: On Windows, %CATALINA_BASE%\bin\setenv.bat: set "JRE_HOME=%ProgramFiles%\Java\jre7" exit /b 0 On *nix, $CATALINA_BASE/bin/setenv.sh: JRE_HOME=/usr/java/latest CATALINA_PID="$CATALINA_BASE/tomcat.pid" The CATALINA_HOME and CATALINA_BASE variables cannot be configured in the setenv script, because they are used to locate that file. All the environment variables described here and the "setenv" script are used only if you use the standard scripts to launch Tomcat. For example, if you have installed Tomcat as a service on Windows, the service wrapper launches Java directly and does not use the script files. ++++++++++++++++++++++ End Quote +++++++++++++++++++++++++++++++++ As per the instructions above, I created the file %CATALINA_BASE/bin/setenv.sh [specifically: /usr/share/tomcat/bin/setenv.sh]. In this file, I placed several environmental variable settings. Then, I executed the command ./catalina.sh start. This action should have caused an access to my setenv.sh file, and set the several environmental variables. What I found is that the file was not accessed. Assuming that it is a bug, I created a work-around that seems to fix the problem for me: +++++++++++++++++ Begin Diff (/etc/tomcat/tomcat.conf) +++++++++++ diff --git a/tomcat.conf b/tomcat.conf index a90461f..b58e618 100644 --- a/tomcat.conf +++ b/tomcat.conf @@ -46,6 +46,12 @@ SHUTDOWN_VERBOSE="false" # If you wish to further customize your tomcat environment, # put your own definitions here # (i.e. LD_LIBRARY_PATH for some jdbc drivers) + +if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then + . "$CATALINA_BASE/bin/setenv.sh" +elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then + . "$CATALINA_HOME/bin/setenv.sh" +fi # Clear work directory when tomcat is stopped or restarted CLEAR_WORK="false" +++++++++++++++++ End Diff (/etc/tomcat/tomcat.conf) +++++++++++++ Of course, rather than having NetIQ customers implement this fix manually, it would be better if something similar were released by SLES as a bug fix. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=1002662 http://bugzilla.novell.com/show_bug.cgi?id=1002662#c1 Adam Jerome <adam.jerome@microfocus.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Found By|--- |Development OS|SLES 12 |openSUSE 42.1 --- Comment #1 from Adam Jerome <adam.jerome@microfocus.com> ---
Tomas Chvatal 10/3/2016 1:32 PM >>>
I checked the proposed solution of yours and I would say all these variables should maybe set by sysconfig variables of tomcat instead of using another environment propagation. But if it is used by upstream documentation then indeed we should be able to parse them (our behaviour is a bug) and your patch fixes that so it should be included, if it works for you. The only thing I would change is to source those on top of the .conf file to allow overriding of the values in the config. Inheritance order to be sysconfig -> env_file -> .conf_file. Also you can send your solution to openSUSE yourself and just ask bogdano to cherry-pick it for the next update I guess. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=1002662 http://bugzilla.novell.com/show_bug.cgi?id=1002662#c2 --- Comment #2 from Adam Jerome <adam.jerome@microfocus.com> --- (In reply to Adam Jerome from comment #1) A new version of the patch, sourced "on top of the .conf file to allow overriding of the values in the config.": Author: Adam Jerome <adam.jerome@microfocus.com> Date: Mon Oct 3 15:01:20 2016 -0600 Tomas Chvatal approved source location of the setenv.sh patch diff --git a/tomcat.conf b/tomcat.conf index 5a742fa..21bfffe 100644 --- a/tomcat.conf +++ b/tomcat.conf @@ -10,6 +10,14 @@ CATALINA_HOME="/usr/share/tomcat" CATALINA_BASE="/usr/share/tomcat" # the temp dir of the instance CATALINA_TMPDIR="/var/cache/tomcat/temp" + +# Include the optional setenv.sh script. +# (See section 3.4 of https://tomcat.apache.org/tomcat-8.0-doc/RUNNING.txt) +if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then + . "$CATALINA_BASE/bin/setenv.sh" +elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then + . "$CATALINA_HOME/bin/setenv.sh" +fi # You can pass some parameters to java here if you wish to #JAVA_OPTS="-Xminf0.1 -Xmaxf0.3 -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com