Bug 1094545 - init script does not correctly handle CATALINA_HOME and CATALINA_BASE
Summary: init script does not correctly handle CATALINA_HOME and CATALINA_BASE
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Fedora EPEL
Classification: Fedora
Component: tomcat
Version: el6
Hardware: All
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Coty Sutherland
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-05-06 00:31 UTC by Richard Davies
Modified: 2019-09-26 14:59 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-09-26 14:59:23 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
/etc/init.d/tomcat patch to create CATALINA_BASE rather than CATALINA_HOME (3.96 KB, patch)
2014-05-06 00:31 UTC, Richard Davies
no flags Details | Diff

Description Richard Davies 2014-05-06 00:31:25 UTC
Created attachment 892741 [details]
/etc/init.d/tomcat patch to create CATALINA_BASE rather than CATALINA_HOME

Description of problem:

/etc/init.d/tomcat uses CATALINA_HOME instead of CATALINA_BASE when deciding the initd.log file location or creating a new tomcat directory. It would be safer to create a new CATALINA_BASE instance rather than a new CATALINA_HOME.

It also ignores whether CATALINA_BASE has been customised in /etc/tomcat/tomcat.conf or /etc/sysconfig/$NAME.

Version-Release number of selected component (if applicable):

7.0.33-4.el6

How reproducible:

Always.

Steps to Reproduce:

1. Create a tomcat instance as per comments in /etc/sysconfig/tomcat
2. change $CATALINA_BASE

Actual results:

1. If $CATALINA_BASE does not exist, the instance will not start - the intention seems to be that the makeHomeDir should fix this, but only expects $CATALINA_HOME to have been changed, and doesn't consider $CATALINA_BASE.

2. $NAME-initrd.log file is written to $CATALINA_HOME/logs rather than $CATALINA_BASE/logs, if $TOMCAT_LOG is not set.

Expected results:

1. $CATALINA_BASE is configured if it doesn't exist.

2. $NAME-initrd.log files are written to $CATALINA_BASE/logs 

3. I'd suggest init script should exit with error if $CATALINA_HOME does not exist, as $CATALINA_HOME/bin (/usr/share/tomcat/bin) may be required.

Additional info:

1. the init script makes the assumption that a group called $TOMCAT_USER exists, whereas the RHEL6 tomcat6 package uses a $TOMCAT_GROUP environment variable instead, which is more flexible/reliable.

2. the init script also assumes that $CATALINA_PID will not be set in /etc/tomcat/tomcat.conf or /etc/sysconfig/$NAME when fixing ownership (should happen after parseOptions).

I've attached a patch that worked for me, by only creating $CATALINA_BASE if it doesn't exist, and failing if $CATALINA_HOME does not exist.

Comment 1 Rahul Sundaram 2014-12-04 21:44:07 UTC
ping

Comment 2 Rahul Sundaram 2015-01-17 06:12:34 UTC
anyone

Comment 3 Coty Sutherland 2015-12-10 20:58:35 UTC
Given that the CATALINA_HOME directory should be the tomcat root and the CATALINA_BASE dir should point to instance specific things (from https://tomcat.apache.org/tomcat-7.0-doc/introduction.html#Directories_and_Files), I think that the provided patch is correct and it looks good to me at first glance.

I'll take a stab at incorporating it into an update and let Ivan take a look.

Comment 4 Rob Noble 2015-12-17 13:11:19 UTC
FWIW, the patch fixed a problem for me - I create a Tomcat instance with its own CATALINA-BASE in /etc/sysconfig/{$NAME}/ but if I tried to configure ports to the standard values of 8005/8009/8080 in server.xml (the primary instance isn't in use...), then the init script replaced them with random values, making it inconsistent with my httpd config.

Comment 5 Coty Sutherland 2019-09-26 14:59:23 UTC
I'm not sure how this went so long without being addressed, but given the length of time since the last comment I'm just going to set it closed/wontfix. If there is expressed interest in having this fix added, I can but since it's a script fix its easy to apply when needed.


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