-
Bug
-
Resolution: Done
-
Major
-
JWS 3.0.1 ER1
-
None
-
Release Notes
-
-
-
-
-
-
Documented as Resolved Issue
When I start tomcat with default user and group, then stop it, change tomcat user in /etc/tomcat8/tomcat8.conf file to some other existing user, then when I start tomcat it will not start. In /var/log/tomcat8-initd.log I can see:
/usr/sbin/tomcat8: line 24: /usr/share/tomcat8/logs/catalina.out: Permission denied /usr/sbin/tomcat8: line 24: /usr/share/tomcat8/logs/catalina.out: Permission denied
Problem is that after the tomcat user has been changed in configuration there is no update of ownership of that log file (this ownership is made only when makeHomeDir function is called). Suppose that it should be done in init script during startup. Proposing following change:
[root@dev226 init.d]# diff -u tomcat8 tomcat8.new --- tomcat8 2015-07-21 10:01:31.277471585 -0400 +++ tomcat8.new 2015-07-21 10:48:39.144162424 -0400 @@ -123,7 +123,6 @@ cp -pLR /usr/share/${NAME}/conf $CATALINA_HOME ln -fs /usr/share/java/tomcat8 ${CATALINA_HOME}/lib ln -fs /usr/share/tomcat8/webapps ${CATALINA_HOME}/webapps - chown ${TOMCAT_USER}:${TOMCAT_GROUP} /var/log/${NAME} fi } @@ -173,9 +172,12 @@ sed -i -e "s/8005/${randomPort1}/g" -e "s/8080/${CONNECTOR_PORT}/g" \ -e "s/8009/${randomPort2}/g" -e "s/8443/${randomPort3}/g" \ ${CATALINA_HOME}/conf/server.xml + if [ "$?" != "0" ]; then + exit 4 + fi fi - if [ "$?" != "0" ]; then - exit 4 + if [ -f "/var/log/${NAME}" ]; then + chown ${TOMCAT_USER}:${TOMCAT_GROUP} /var/log/${NAME} fi parseOptions if [ "$SECURITY_MANAGER" = "true" ]; then
Although for successfull tomcat start it was enough to change ownership to /var/log/tomcat8/catalina.out file, there are usually more files in /var/log/tomcat8 directory and they might need to change its ownership too...
Same thing for tomcat7...
- relates to
-
JWS-888 [RHEL 6 RPM] change in TOMCAT_USER makes tomcat fail to start
- Closed