Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 80289 - Tomcat5 (5.0.27-r4) will not bind to port 80 when started via /etc/init.d/tomcat5 script
Summary: Tomcat5 (5.0.27-r4) will not bind to port 80 when started via /etc/init.d/tom...
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Jan Brinkmann (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-01-31 22:03 UTC by Burhan Khalid
Modified: 2005-02-10 05:56 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Burhan Khalid 2005-01-31 22:03:07 UTC
Tomcat refuses to bind to port 80 when initiated via the init.d scripts (I'm launching tomcat as root).  There is a permissions issue, seems that tomcat is not run as root, which naturally doesn't allow it to bind to port 80 (I am not running any other server program that uses 80, ie. no Apache).  The init script reports [ ok ], even though in catalina.out the error message clearly states that it couldn't bind to 80.

I changed the CATALINA_USER variable in the configuration file to root, but it still would not bind to port 80.

However, when I run the /etc/opt/tomcat5/bin/startup* scripts as root, it binds to port 80 correctly.  Even with CATALINA_USER=tomcat.

Reproducible: Always
Steps to Reproduce:
1. emerge tomcat
2. change server.xml so that the default port is 80
3. /etc/init.d/tomcat5 start

Actual Results:  
The init script worked as expected (it showed a green [ ok ]), however tomcat
did not start because it could not bind to port 80

Expected Results:  
Tomcat should have bound to port 80

Portage 2.0.51-r15 (default-linux/x86/2004.3, gcc-3.3.5,
glibc-2.3.4.20040808-r1, 2.6.10-gentoo-r6 i686)
=================================================================
System uname: 2.6.10-gentoo-r6 i686 Intel(R) Pentium(R) 4 CPU 2.66GHz
Gentoo Base System version 1.4.16
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Jan 31 2005, 14:07:45)]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.7.9-r1, 1.8.5-r3, 1.5, 1.4_p6, 1.6.3, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r1
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.4.21-r1
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -frename-registers -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config
/usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=pentium4 -fomit-frame-pointer -frename-registers -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distlocks sandbox sfperms"
GENTOO_MIRRORS="http://distfiles.gentoo.org
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 apm avi berkdb bitmap-fonts crypt cups encode f77 font-server
foomaticdb fortran gdbm gif gpm gtk2 imlib ipv6 java jpeg libg++ libwww mad
mikmod motif mpeg ncurses nls oggvorbis oss pam pdflib perl png python quicktime
readline sdl spell ssl svga tcpd truetype truetype-fonts type1-fonts xml2 xmms
xv zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LANG, LC_ALL, LDFLAGS, PORTDIR_OVERLAY
Comment 1 Burhan Khalid 2005-02-01 00:44:24 UTC
Update:

Adjusting the /etc/init.d/tomcat5 script as thus :

#!/sbin/runscript
# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/www-servers/tomcat/files/5.0.27/tomcat.init,v 1.3 2004/10/08 13:38:08 axxo Exp $

depend() {
        use dns logger mysql postgresql net
}

start() {
        ebegin "Starting Tomcat"
        #start-stop-daemon --start --quiet --chuid tomcat:tomcat --exec ${CATALINA_HOME}/bin/catalina.sh -- ${TOMCAT_START}
        start-stop-daemon --start --quiet --exec ${CATALINA_HOME}/bin/catalina.sh -- ${TOMCAT_START}
        sleep 5
        eend $?
}

stop()  {
        ebegin "Stopping Tomcat"
        #start-stop-daemon --start --quiet --chuid tomcat:tomcat --exec ${CATALINA_HOME}/bin/catalina.sh -- ${TOMCAT_STOP}
        start-stop-daemon --start --quiet --exec ${CATALINA_HOME}/bin/catalina.sh -- ${TOMCAT_STOP}
        sleep 5
        eend $?
}

Fixed the problem for me, although I'm not sure how "correct" this solution is.
Comment 2 Jan Brinkmann (RETIRED) gentoo-dev 2005-02-07 15:47:35 UTC
i'm now going to maintain tomcat. starting from tomorrow i'll start to work on this
Comment 3 Jan Brinkmann (RETIRED) gentoo-dev 2005-02-10 05:56:46 UTC
i don't think that we should do that per default. the process itself should run as user tomcat. please wait for this "feature" in the official initscript until i've got the 5.5.x version up and running as i'll do that via jsvc there.