Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
tomcat won't start
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
moon44
n00b
n00b


Joined: 03 Feb 2005
Posts: 5

PostPosted: Tue Sep 06, 2005 9:51 am    Post subject: tomcat won't start Reply with quote

My tomcat always worked fine. But since I rebootet my machine the last time it hangs while starting. I rebootet because I compiled a new kernel (2.6.12), but I don't think that's the reason because tomcat behaves the same when booting the old 2.4 kernel.

The tomcat version is 5.0.27-r6. I have two jdks installed: blackdown-jdk-1.4.2.02 and sun-jdk1.5.0_01. I tried both, it does not work.

Here's the catalina.out:
Code:

06.09.2005 11:24:54 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
06.09.2005 11:24:54 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 903 ms
06.09.2005 11:24:54 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
06.09.2005 11:24:54 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.0.27
06.09.2005 11:24:54 org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
06.09.2005 11:24:54 org.apache.catalina.core.StandardHost getDeployer
INFO: Create Host deployer for direct deployment ( non-jmx )
06.09.2005 11:24:54 org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:/etc/tomcat5/Catalina/localhost/manager.xml
06.09.2005 11:24:55 org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:/etc/tomcat5/Catalina/localhost/admin.xml
06.09.2005 11:24:55 org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true
06.09.2005 11:24:55 org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.struts.action.ActionResources', returnNull=true
06.09.2005 11:24:56 org.apache.struts.util.PropertyMessageResources <init>
INFO: Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true
06.09.2005 11:24:57 org.apache.catalina.core.StandardHostDeployer install
INFO: Processing Context configuration file URL file:/etc/tomcat5/Catalina/localhost/balancer.xml
06.09.2005 11:24:57 org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path  from URL file:/opt/tomcat5/webapps/ROOT
06.09.2005 11:24:57 org.apache.catalina.core.StandardHostDeployer install
INFO: Installing web application at context path /webdav from URL file:/opt/tomcat5/webapps/webdav
06.09.2005 11:24:57 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
06.09.2005 11:24:57 org.apache.jk.common.ChannelSocket init
INFO: JK2: ajp13 listening on /0.0.0.0:8009
06.09.2005 11:24:57 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/18  config=/opt/tomcat5/conf/jk2.properties
06.09.2005 11:24:57 org.apache.catalina.startup.Catalina start
INFO: Server startup in 3277 ms
06.09.2005 11:24:58 org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
06.09.2005 11:24:59 org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
06.09.2005 11:24:59 org.apache.catalina.core.StandardHostDeployer remove
INFO: Removing web application at context path /admin
06.09.2005 11:24:59 org.apache.catalina.logger.LoggerBase stop
INFO: unregistering logger Catalina:type=Logger,path=/admin,host=localhost
06.09.2005 11:24:59 org.apache.catalina.core.StandardHostDeployer remove
INFO: Removing web application at context path /webdav
06.09.2005 11:24:59 org.apache.catalina.core.StandardHostDeployer remove
INFO: Removing web application at context path /balancer
06.09.2005 11:24:59 org.apache.catalina.core.StandardHostDeployer remove
INFO: Removing web application at context path
06.09.2005 11:24:59 org.apache.catalina.core.StandardHostDeployer remove
INFO: Removing web application at context path /manager
06.09.2005 11:24:59 org.apache.catalina.logger.LoggerBase stop
INFO: unregistering logger Catalina:type=Logger,host=localhost
06.09.2005 11:24:59 org.apache.catalina.logger.LoggerBase stop
INFO: unregistering logger Catalina:type=Logger
06.09.2005 11:24:59 org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080

It seems that tomcat starts and then stops, but the process does not return and I get no error message.

I removed all webapps and reinstalled tomcat without success.

Has anyone an idea? Thanks!
Back to top
View user's profile Send private message
Gecko945
n00b
n00b


Joined: 12 Apr 2003
Posts: 58

PostPosted: Thu Nov 17, 2005 3:13 am    Post subject: Reply with quote

Same problem here, no solution yet.

After "emerge unmerge tomcat && rm -r /opt/tomcat /etc/tomcat"
I reinstalled tomcat tomcat-5.0.27-r6 again
No change.

Code:
# java-config -L
[sun-jdk-1.5.0.05] "Sun JDK 1.5.0.05" (/etc/env.d/java/20sun-jdk-1.5.0.05) *
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Nov 19, 2005 9:38 am    Post subject: Reply with quote

Same for me, just emerged today
Code:
[ebuild   R   ] www-servers/tomcat-5.0.27-r6  -doc -jikes 0 kB

and I have
Code:
# java-config -L
[blackdown-jre-1.4.2.02] "Blackdown JRE 1.4.2.02" (/etc/env.d/java/20blackdown-jre-1.4.2.02)
[blackdown-jdk-1.4.2.02] "Blackdown JDK 1.4.2.02" (/etc/env.d/java/20blackdown-jdk-1.4.2.02) *

This is the log, it tries to shutdown immediately after starting.
Code:
Nov 19, 2005 10:08:46 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3390 ms
Nov 19, 2005 10:08:46 AM org.apache.coyote.http11.Http11Protocol pause
INFO: Pausing Coyote HTTP/1.1 on http-8080
Nov 19, 2005 10:08:47 AM org.apache.catalina.core.StandardService stop
INFO: Stopping service Catalina
......
Nov 19, 2005 10:08:47 AM org.apache.catalina.logger.LoggerBase stop
INFO: unregistering logger Catalina:type=Logger
Nov 19, 2005 10:08:47 AM org.apache.coyote.http11.Http11Protocol destroy
INFO: Stopping Coyote HTTP/1.1 on http-8080

Then it hangs with java and runscript.sh using some CPU and I have to kill manually the child runscript.sh process (BTW, why two?)
Code:
# ps -efw | grep runscript
root     11837  8955  0 10:25 pts/3    00:00:00 /bin/bash /sbin/runscript.sh /etc/init.d/tomcat5 start
root     11887 11837  1 10:25 pts/3    00:00:02 /bin/bash /sbin/runscript.sh /etc/init.d/tomcat5 start
# kill 11887
# ps -efw | grep runscript
root     18410 12505  0 10:28 pts/2    00:00:00 grep runscript

Any ideas? Thanks in advance.
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Nov 19, 2005 11:40 am    Post subject: Reply with quote

An update. If I start it manually
Code:
/opt/tomcat5/bin/catalina.sh start

it works without problems, and it works too if I run
Code:
start-stop-daemon --start --quiet --chuid tomcat:tomcat --exec /opt/tomcat5/bin/catalina.sh -- start

that is the exact command executed by the init script
Code:
# cat /etc/init.d/tomcat5
#!/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}
        sleep 5
        eend $?
}

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

given that /etc/conf.d/tomcat5 has
Code:
CATALINA_HOME=/opt/tomcat5
TOMCAT_START="start"
TOMCAT_STOP="stop"

I can't understand why.
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Nov 19, 2005 3:03 pm    Post subject: Reply with quote

OK, this a self service forum :D.

Now I see what's happening
Code:
++ rc_start_daemon
++ eval /sbin/start-stop-daemon ''\''--start'\'' '\''--quiet'\'' '\''--chuid'\'' '\''tomcat:tomcat'\'' '\''--exec'\'' '\''/opt/tomcat5/bin/catalina.sh'\'' '\''--'\'' '\''start'\'''
+++ /sbin/start-stop-daemon --start --quiet --chuid tomcat:tomcat --exec /opt/tomcat5/bin/catalina.sh -- start
++ local retval=0
++ [[ 0 != \0 ]]
++ [[ 0.1 == \0 ]]
++ LC_ALL=C
++ /bin/sleep 0.1
++ is_daemon_running /opt/tomcat5/bin/catalina.sh ''
++ local cmd pidfile pids pid
++ [[ 2 == \1 ]]
++ local i j=2
++ (( i=0 ))
++ (( i<j-1 ))
++ cmd=' /opt/tomcat5/bin/catalina.sh'
++ shift
++ (( i++  ))
++ (( i<j-1 ))
++ pidfile=
+++ pidof /opt/tomcat5/bin/catalina.sh
+++ local arg args
+++ for arg in '"$@"'
+++ [[ catalina.sh == \r\p\c\.\n\f\s\d ]]
+++ args=' '\''/opt/tomcat5/bin/catalina.sh'\'''
+++ eval /bin/pidof -x ''\''/opt/tomcat5/bin/catalina.sh'\'''
++++ /bin/pidof -x /opt/tomcat5/bin/catalina.sh
++ pids=
++ [[ -z '' ]]
++ return 1
++ retval=1
++ [[ 1 == \0 ]]
+++ type -t stop
++ [[ function == \f\u\n\c\t\i\o\n ]]
++ stop

The start function in tomcat init script ends up to call rc_start_deamon in /lib/rcscripts/sh/rc-daemon.sh (because start-stop-daemon is wrapped by a function in the same file, this happens only when start-stop-deamon is called by /sbin/runscript.sh, and it works if called directly from bash). Immediately (or more precisely 0.1 s) after the real /sbin/start-stop-daemon is called, it appears to the is_daemon_running function (by calling pidof -x with the script name as argument) that the service went down, so stop is called.

These are the function definitions from /lib/rcscripts/sh/rc-daemon.sh in sys-apps/baselayout-1.12.0_pre10-r1
Code:
# bool is_daemon_running(char* cmd, char* pidfile)
#
# Returns 0 if the given daemon is running, otherwise 1
# If a pidfile is supplied, the pid inside it must match
# a pid in the list of pidof ${cmd}
is_daemon_running() {
        local cmd pidfile pids pid

        if [[ $# == "1" ]]; then
                cmd="$1"
        else
                local i j="$#"
                for (( i=0; i<j-1; i++ )); do
                        cmd="${cmd} $1"
                        shift
                done
                pidfile="$1"
        fi

        pids=$( pidof ${cmd} )
        [[ -z ${pids} ]] && return 1

        [[ -s ${pidfile} ]] || return 0

        read pid < "${pidfile}"
        pids=" ${pids} "
        [[ ${pids// ${pid} } != "${pids}" ]]
}

# int rc_start_daemon(void)
#
# We don't do anyting fancy - just pass the given options
# to start-stop-daemon and return the value
rc_start_daemon() {
        eval /sbin/start-stop-daemon "${args}"
        local retval="$?"

        [[ ${retval} != "0" ]] && return "${retval}"
        [[ ${RC_WAIT_ON_START} == "0" ]] && return "${retval}"

        # We pause for RC_WAIT_ON_START seconds and then
        # check if the daemon is still running - this is mainly
        # to handle daemons who launch and then fail due to invalid
        # configuration files
        LC_ALL=C /bin/sleep "${RC_WAIT_ON_START}"
        is_daemon_running ${cmd} "${pidfile}"
        retval="$?"
        [[ ${retval} == "0" ]] && return 0

        # Stop if we can to clean things up
        if [[ $( type -t stop ) == "function" ]]; then
                stop >/dev/null # We don't want to echo ebegin/eend
        elif [[ -n ${pidfile} ]]; then
                rc_stop_daemon
        fi
        return "${retval}"
}

So probably the tomcat init script is not compatible with this version of baselayout. I'll try to check differences with stable version.

In the meantime, any idea about how to solve it?
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
dgaffuri
Advocate
Advocate


Joined: 05 Jun 2005
Posts: 2078
Location: Italy

PostPosted: Sat Nov 19, 2005 4:54 pm    Post subject: Reply with quote

OK, I didn't searched enough. There's a bug filed against 5.0.28-r4, that seems to be solved for all 5.0.28 ebuilds. For 5.0.27 I patched init script as suggested, changing start-stop-daemon in /sbin/start-stop-daemon.
_________________
Adopt an unanswered post
If you feel that your problem has been solved please edit the top post and add [solved] to the subject
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum