# Tomcat 5 & 2.6.12 [WAS: tomcat-5 does not start at boot]

## lxnay

I've discovered that the problem appears with 2.6.12 kernel. So, why tomcat 5.0.27 or 5.0.28 don't work with 2.6.12 at boot? In other words, tomcat does not start at boot  :Sad: 

 *Quote:*   

> 
> 
> Hi, I've a huge problem. I've noticed that tomcat did not start from init scripts anymore, port 8080 and 8009 weren't opened by the script /etc/init.d/tomcat5. So I decided to try to update tomcat to the latest version:
> 
> ```
> ...

 

----------

## sheldonh

The fact that it works from the command-line, after startup, sounds like an environment problem or a service dependency problem.  The latter is more likely, given how carefully the jdk stuff is managed in /etc/env.d.

Use java-config -v to check which VM you're using, and make sure it's actually installed.  If it is, and you've done an env-update recently, then this probably isn't an environmental problem.

If you depend on a database other than mysql or postgresql, make sure the service you depend on is in the depend() function in /etc/init.d/tomcat5.

If you depend on a network interface that isn't brought up by a script called net.something which is a symlink to (or is itself) net.eth0 or net.lo (depending on your baselayout version), make sure the network service is in the depend() function in /etc/init.d/tomcat5.

But ultimately, you'll get the best support if you check out /var/log/tomcat5/catalina.out for errors.

----------

## lxnay

I've seen that tomcat-5 starts near the end of the boot process, with many services already up and running.

The depend() is set in this way:

```
depend() {

        use dns logger mysql postgresql net

}

```

Do you think that if I try to put env-update && source /etc/profile in the init script would be useful?

I've already tried to put source /etc/profile at the beginning of the start() function with no luck because I've noticed that some env variables weren't already set.

----------

## rex123

I don't want to sound too obvious, but are you sure that tomcat is in the default runlevel?

Do 

```
rc-status -a | grep 'Runlevel\|tomcat'
```

 to make sure. The output should look like this:

```
Runlevel: boot

Runlevel: default

  tomcat[5]                                                                                                  [ started ]

Runlevel: nonetwork

Runlevel: UNASSIGNED

```

If it doesn't, then do 

```
rc-update add tomcat[5] default
```

If the init script is running, but tomcat is failing to start, you should notice during boot, because it will say "Starting Tomcat"... and there is a delay built into the init script. If it appears to start, but isn't listening on port 8080, look into the catalina.out log (in /var/log/tomcat5/ normally) to see what's happening

----------

## lxnay

For the init scripts, tomcat-5 starts fine ( tag [OK]), and that's the catalina.out:

```

13:01:49,931  INFO Http11Protocol:186 - Pausing Coyote HTTP/1.1 on http-8080

13:01:50,934  INFO StandardService:534 - Stopping service Catalina

13:01:50,935  INFO StandardHostDeployer:668 - Removing web application at context path /admin

13:01:50,955  INFO LoggerBase:514 - unregistering logger Catalina:type=Logger,path=/admin,host=localhost

13:01:50,959  INFO StandardHostDeployer:668 - Removing web application at context path /umin

13:01:50,965  INFO StandardHostDeployer:668 - Removing web application at context path /servlet

13:01:50,971  INFO StandardHostDeployer:668 - Removing web application at context path /manager

13:01:50,978  INFO LoggerBase:514 - unregistering logger Catalina:type=Logger,host=localhost

13:01:50,979  INFO LoggerBase:514 - unregistering logger Catalina:type=Logger

13:01:50,979  INFO Http11Protocol:200 - Stopping Coyote HTTP/1.1 on http-8080

13:04:43,876  INFO Http11Protocol:142 - Initializing Coyote HTTP/1.1 on http-8080

13:04:44,012  INFO Catalina:514 - Initialization processed in 1277 ms

13:04:44,356  INFO StandardService:472 - Starting service Catalina

13:04:44,362  INFO StandardEngine:467 - Starting Servlet Engine: Apache Tomcat/5.0

13:04:44,380  INFO StandardHost:787 - XML validation disabled

13:04:44,383  INFO StandardHost:1024 - Create Host deployer for direct deployment ( non-jmx ) 

13:04:44,390  INFO StandardHostDeployer:435 - Processing Context configuration file URL file:/etc/tomcat-5/default/Catalina/localhost/manager.xml

13:04:47,718  INFO StandardHostDeployer:435 - Processing Context configuration file URL file:/etc/tomcat-5/default/Catalina/localhost/admin.xml

13:04:48,353  INFO PropertyMessageResources:127 - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true

13:04:48,355  INFO PropertyMessageResources:127 - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true

13:04:48,912  INFO PropertyMessageResources:127 - Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true

```

Tomcat 5.0.27 and 5.0.28 have the same problem.

----------

## minskpower

Post your server.xml and struts-config.xml if you have one.

The logs are not verbose enough

----------

## lxnay

This is the difference between the old server.xml and the new one:

```
--- /home/fabio/tomcat5/conf/server.xml 2005-01-30 20:53:42.000000000 +0100

+++ /etc/tomcat-5/default/server.xml    2005-06-20 23:18:47.000000000 +0200

@@ -10,7 +10,7 @@

      define subcomponents such as "Valves" or "Loggers" at this level.

  -->

-<Server port="8005" shutdown="SHUTDOWN" debug="0">

+<Server port="8005" shutdown="46ee586c4b9fddd" debug="0">

   <!-- Comment these entries out to disable JMX MBeans support -->

```

And this is the current server.xml

```

<!-- Example Server Configuration File -->

<!-- Note that component elements are nested corresponding to their

     parent-child relationships with each other -->

<!-- A "Server" is a singleton element that represents the entire JVM,

     which may contain one or more "Service" instances.  The Server

     listens for a shutdown command on the indicated port.

     Note:  A "Server" is not itself a "Container", so you may not

     define subcomponents such as "Valves" or "Loggers" at this level.

 -->

<Server port="8005" shutdown="46ee586c4b9fddd" debug="0">

  <!-- Comment these entries out to disable JMX MBeans support -->

  <!-- You may also configure custom components (e.g. Valves/Realms) by 

       including your own mbean-descriptor file(s), and setting the 

       "descriptors" attribute to point to a ';' seperated list of paths

       (in the ClassLoader sense) of files to add to the default list.

       e.g. descriptors="/com/myfirm/mypackage/mbean-descriptor.xml"

  -->

  <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener"

            debug="0"/>

  <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener"

            debug="0"/>

  <!-- Global JNDI resources -->

  <GlobalNamingResources>

    <!-- Test entry for demonstration purposes -->

    <Environment name="simpleValue" type="java.lang.Integer" value="30"/>

    <!-- Editable user database that can also be used by

         UserDatabaseRealm to authenticate users -->

    <Resource name="UserDatabase" auth="Container"

              type="org.apache.catalina.UserDatabase"

       description="User database that can be updated and saved">

    </Resource>

    <ResourceParams name="UserDatabase">

      <parameter>

        <name>factory</name>

        <value>org.apache.catalina.users.MemoryUserDatabaseFactory</value>

      </parameter>

      <parameter>

        <name>pathname</name>

        <value>conf/tomcat-users.xml</value>

      </parameter>

    </ResourceParams>

  </GlobalNamingResources>

  <!-- A "Service" is a collection of one or more "Connectors" that share

       a single "Container" (and therefore the web applications visible

       within that Container).  Normally, that Container is an "Engine",

       but this is not required.

       Note:  A "Service" is not itself a "Container", so you may not

       define subcomponents such as "Valves" or "Loggers" at this level.

   -->

  <!-- Define the Tomcat Stand-Alone Service -->

  <Service name="Catalina">

    <!-- A "Connector" represents an endpoint by which requests are received

         and responses are returned.  Each Connector passes requests on to the

         associated "Container" (normally an Engine) for processing.

         By default, a non-SSL HTTP/1.1 Connector is established on port 8080.

         You can also enable an SSL HTTP/1.1 Connector on port 8443 by

         following the instructions below and uncommenting the second Connector

         entry.  SSL support requires the following steps (see the SSL Config

         HOWTO in the Tomcat 5 documentation bundle for more detailed

         instructions):

         * If your JDK version 1.3 or prior, download and install JSSE 1.0.2 or

           later, and put the JAR files into "$JAVA_HOME/jre/lib/ext".

         * Execute:

             %JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA (Windows)

             $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA  (Unix)

           with a password value of "changeit" for both the certificate and

           the keystore itself.

         By default, DNS lookups are enabled when a web application calls

         request.getRemoteHost().  This can have an adverse impact on

         performance, so you can disable it by setting the

         "enableLookups" attribute to "false".  When DNS lookups are disabled,

         request.getRemoteHost() will return the String version of the

         IP address of the remote client.

    -->

    <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->

    <Connector port="8080"

               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

               enableLookups="false" redirectPort="8443" acceptCount="100"

               debug="0" connectionTimeout="20000" 

               disableUploadTimeout="true" />

    <!-- Note : To disable connection timeouts, set connectionTimeout value

     to 0 -->

   

   <!-- Note : To use gzip compression you could set the following properties :

   

            compression="on" 

            compressionMinSize="2048" 

            noCompressionUserAgents="gozilla, traviata" 

            compressableMimeType="text/html,text/xml"

   -->

    <!-- Define a SSL Coyote HTTP/1.1 Connector on port 8443 -->

    <!--

    <Connector port="8443" 

               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

               enableLookups="false" disableUploadTimeout="true"

               acceptCount="100" debug="0" scheme="https" secure="true"

               clientAuth="false" sslProtocol="TLS" />

    -->

    <!-- Define a Coyote/JK2 AJP 1.3 Connector on port 8009 -->

    <Connector port="8009" 

               enableLookups="false" redirectPort="8443" debug="0"

               protocol="AJP/1.3" />

    <!-- Define a Proxied HTTP/1.1 Connector on port 8082 -->

    <!-- See proxy documentation for more information about using this. -->

    <!--

    <Connector port="8082" 

               maxThreads="150" minSpareThreads="25" maxSpareThreads="75"

               enableLookups="false"

               acceptCount="100" debug="0" connectionTimeout="20000"

               proxyPort="80" disableUploadTimeout="true" />

    -->

    <!-- An Engine represents the entry point (within Catalina) that processes

         every request.  The Engine implementation for Tomcat stand alone

         analyzes the HTTP headers included with the request, and passes them

         on to the appropriate Host (virtual host). -->

    <!-- You should set jvmRoute to support load-balancing via JK/JK2 ie :

    <Engine name="Standalone" defaultHost="localhost" debug="0" jvmRoute="jvm1">         

    --> 

         

    <!-- Define the top level container in our container hierarchy -->

    <Engine name="Catalina" defaultHost="localhost" debug="0">

      <!-- The request dumper valve dumps useful debugging information about

           the request headers and cookies that were received, and the response

           headers and cookies that were sent, for all requests received by

           this instance of Tomcat.  If you care only about requests to a

           particular virtual host, or a particular application, nest this

           element inside the corresponding <Host> or <Context> entry instead.

           For a similar mechanism that is portable to all Servlet 2.4

           containers, check out the "RequestDumperFilter" Filter in the

           example application (the source for this filter may be found in

           "$CATALINA_HOME/webapps/examples/WEB-INF/classes/filters").

           Request dumping is disabled by default.  Uncomment the following

           element to enable it. -->

      <!--

      <Valve className="org.apache.catalina.valves.RequestDumperValve"/>

      -->

      <!-- Global logger unless overridden at lower levels -->

      <Logger className="org.apache.catalina.logger.FileLogger"

              prefix="catalina_log." suffix=".txt"

              timestamp="true"/>

      <!-- Because this Realm is here, an instance will be shared globally -->

      <!-- This Realm uses the UserDatabase configured in the global JNDI

           resources under the key "UserDatabase".  Any edits

           that are performed against this UserDatabase are immediately

           available for use by the Realm.  -->

      <Realm className="org.apache.catalina.realm.UserDatabaseRealm"

                 debug="0" resourceName="UserDatabase"/>

      <!-- Comment out the old realm but leave here for now in case we

           need to go back quickly -->

      <!--

      <Realm className="org.apache.catalina.realm.MemoryRealm" />

      -->

      <!-- Replace the above Realm with one of the following to get a Realm

           stored in a database and accessed via JDBC -->

      <!--

      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"

             driverName="org.gjt.mm.mysql.Driver"

          connectionURL="jdbc:mysql://localhost/authority"

         connectionName="test" connectionPassword="test"

              userTable="users" userNameCol="user_name" userCredCol="user_pass"

          userRoleTable="user_roles" roleNameCol="role_name" />

      -->

      <!--

      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"

             driverName="oracle.jdbc.driver.OracleDriver"

          connectionURL="jdbc:oracle:thin:@ntserver:1521:ORCL"

         connectionName="scott" connectionPassword="tiger"

              userTable="users" userNameCol="user_name" userCredCol="user_pass"

          userRoleTable="user_roles" roleNameCol="role_name" />

      -->

      <!--

      <Realm  className="org.apache.catalina.realm.JDBCRealm" debug="99"

             driverName="sun.jdbc.odbc.JdbcOdbcDriver"

          connectionURL="jdbc:odbc:CATALINA"

              userTable="users" userNameCol="user_name" userCredCol="user_pass"

          userRoleTable="user_roles" roleNameCol="role_name" />

      -->

      <!-- Define the default virtual host

           Note: XML Schema validation will not work with Xerces 2.2.

       -->

      <Host name="localhost" debug="0" appBase="webapps"

       unpackWARs="true" autoDeploy="true"

       xmlValidation="false" xmlNamespaceAware="false">

        <!-- Defines a cluster for this node,

             By defining this element, means that every manager will be changed.

             So when running a cluster, only make sure that you have webapps in there

             that need to be clustered and remove the other ones.

             A cluster has the following parameters:

             className = the fully qualified name of the cluster class

             name = a descriptive name for your cluster, can be anything

             debug = the debug level, higher means more output

             mcastAddr = the multicast address, has to be the same for all the nodes

             mcastPort = the multicast port, has to be the same for all the nodes

             

             mcastBindAddr = bind the multicast socket to a specific address

             

             mcastTTL = the multicast TTL if you want to limit your broadcast

             

             mcastSoTimeout = the multicast readtimeout 

             mcastFrequency = the number of milliseconds in between sending a "I'm alive" heartbeat

             mcastDropTime = the number a milliseconds before a node is considered "dead" if no heartbeat is received

             tcpThreadCount = the number of threads to handle incoming replication requests, optimal would be the same amount of threads as nodes 

             tcpListenAddress = the listen address (bind address) for TCP cluster request on this host, 

                                in case of multiple ethernet cards.

                                auto means that address becomes

                                InetAddress.getLocalHost().getHostAddress()

             tcpListenPort = the tcp listen port

             tcpSelectorTimeout = the timeout (ms) for the Selector.select() method in case the OS

                                  has a wakup bug in java.nio. Set to 0 for no timeout

             printToScreen = true means that managers will also print to std.out

             expireSessionsOnShutdown = true means that 

             useDirtyFlag = true means that we only replicate a session after setAttribute,removeAttribute has been called.

                            false means to replicate the session after each request.

                            false means that replication would work for the following piece of code:

                            <%

                            HashMap map = (HashMap)session.getAttribute("map");

                            map.put("key","value");

                            %>

             replicationMode = can be either 'pooled', 'synchronous' or 'asynchronous'.

                               * Pooled means that the replication happens using several sockets in a synchronous way. Ie, the data gets replicated, then the request return. This is the same as the 'synchronous' setting except it uses a pool of sockets, hence it is multithreaded. This is the fastest and safest configuration. To use this, also increase the nr of tcp threads that you have dealing with replication.

                               * Synchronous means that the thread that executes the request, is also the

                               thread the replicates the data to the other nodes, and will not return until all

                               nodes have received the information.

                               * Asynchronous means that there is a specific 'sender' thread for each cluster node,

                               so the request thread will queue the replication request into a "smart" queue,

                               and then return to the client.

                               The "smart" queue is a queue where when a session is added to the queue, and the same session

                               already exists in the queue from a previous request, that session will be replaced

                               in the queue instead of replicating two requests. This almost never happens, unless there is a 

                               large network delay.

        -->             

        <!--

            When configuring for clustering, you also add in a valve to catch all the requests

            coming in, at the end of the request, the session may or may not be replicated.

            A session is replicated if and only if all the conditions are met:

            1. useDirtyFlag is true or setAttribute or removeAttribute has been called AND

            2. a session exists (has been created)

            3. the request is not trapped by the "filter" attribute

            The filter attribute is to filter out requests that could not modify the session,

            hence we don't replicate the session after the end of this request.

            The filter is negative, ie, anything you put in the filter, you mean to filter out,

            ie, no replication will be done on requests that match one of the filters.

            The filter attribute is delimited by ;, so you can't escape out ; even if you wanted to.

            filter=".*\.gif;.*\.js;" means that we will not replicate the session after requests with the URI

            ending with .gif and .js are intercepted.

            

            The deployer element can be used to deploy apps cluster wide.

            Currently the deployment only deploys/undeploys to working members in the cluster

            so no WARs are copied upons startup of a broken node.

            The deployer watches a directory (watchDir) for WAR files when watchEnabled="true"

            When a new war file is added the war gets deployed to the local instance,

            and then deployed to the other instances in the cluster.

            When a war file is deleted from the watchDir the war is undeployed locally 

            and cluster wide

        -->

        

        <!--

        <Cluster className="org.apache.catalina.cluster.tcp.SimpleTcpCluster"

                 managerClassName="org.apache.catalina.cluster.session.DeltaManager"

                 expireSessionsOnShutdown="false"

                 useDirtyFlag="true">

            <Membership 

                className="org.apache.catalina.cluster.mcast.McastService"

                mcastAddr="228.0.0.4"

                mcastPort="45564"

                mcastFrequency="500"

                mcastDropTime="3000"/>

            <Receiver 

                className="org.apache.catalina.cluster.tcp.ReplicationListener"

                tcpListenAddress="auto"

                tcpListenPort="4001"

                tcpSelectorTimeout="100"

                tcpThreadCount="6"/>

            <Sender

                className="org.apache.catalina.cluster.tcp.ReplicationTransmitter"

                replicationMode="pooled"/>

            <Valve className="org.apache.catalina.cluster.tcp.ReplicationValve"

                   filter=".*\.gif;.*\.js;.*\.jpg;.*\.htm;.*\.html;.*\.txt;"/>

                   

            <Deployer className="org.apache.catalina.cluster.deploy.FarmWarDeployer"

                      tempDir="/tmp/war-temp/"

                      deployDir="/tmp/war-deploy/"

                      watchDir="/tmp/war-listen/"

                      watchEnabled="false"/>

        </Cluster>

        -->        

        <!-- Normally, users must authenticate themselves to each web app

             individually.  Uncomment the following entry if you would like

             a user to be authenticated the first time they encounter a

             resource protected by a security constraint, and then have that

             user identity maintained across *all* web applications contained

             in this virtual host. -->

        <!--

        <Valve className="org.apache.catalina.authenticator.SingleSignOn"

                   debug="0"/>

        -->

        <!-- Access log processes all requests for this virtual host.  By

             default, log files are created in the "logs" directory relative to

             $CATALINA_HOME.  If you wish, you can specify a different

             directory with the "directory" attribute.  Specify either a relative

             (to $CATALINA_HOME) or absolute path to the desired directory.

        -->

        <!--

        <Valve className="org.apache.catalina.valves.AccessLogValve"

                 directory="logs"  prefix="localhost_access_log." suffix=".txt"

                 pattern="common" resolveHosts="false"/>

        -->

        <!-- Logger shared by all Contexts related to this virtual host.  By

             default (when using FileLogger), log files are created in the "logs"

             directory relative to $CATALINA_HOME.  If you wish, you can specify

             a different directory with the "directory" attribute.  Specify either a

             relative (to $CATALINA_HOME) or absolute path to the desired

             directory.-->

        <Logger className="org.apache.catalina.logger.FileLogger"

                 directory="logs"  prefix="localhost_log." suffix=".txt"

            timestamp="true"/>

      </Host>

    </Engine>

  </Service>

</Server>

```

I have no struts-config.xml

I don't understand this problem yet, it's suddenly appeared.[/code]

----------

## minskpower

Config seems fine, try and comment out the two mbeans listeners, see if it does it.

Also, check your contexts in Catalina/localhost or Catalina/yourhost. Maybe something stayed there after upgrade and needs some custom jar (mysql jdbc driver sometimes hickups on start if using connection pooling).

Check your common/lib folder for missing or corrupted jars. 3rd party stuff should go there, if some app requires them tomcat will complain if not found. Check classpath.

I have a weird random effect sometimes, the admin app writes context.xml as a folder!! obviously that screws stuff and I have to manually rewrite it.

If all else fail, consider downgrading

Ps: what sdk are you using, blackdown's or the original?

----------

## lxnay

All correct but:

```

# differ

mars lib # diff -Nurp /var/lib/tomcat-5/default/webapps/servlet/WEB-INF/lib/jdom.jar /usr/share/jdom-1.0_beta9/lib/jdom.jar

Files /var/lib/tomcat-5/default/webapps/servlet/WEB-INF/lib/jdom.jar and /usr/share/jdom-1.0_beta9/lib/jdom.jar differ

#equal

diff -Nurp /var/lib/tomcat-5/default/webapps/servlet/WEB-INF/lib/jdbc3-postgresql.jar /usr/share/jdbc3-postgresql/lib/jdbc3-postgresql.jar

mars lib # 

```

----------

## rex123

 *lxnay wrote:*   

> For the init scripts, tomcat-5 starts fine ( tag [OK]), and that's the catalina.out:
> 
> ```
> 
> [...]
> ...

 

Sorry to come back into this late, but I don't see a problem here. The log you quoted seems to be from a tomcat restart, which all went fine. Coyote was listening on port 8080 at the end of it.

You said the problem was that it doesn't start at boot, but it does start when you run it from the command-line. But the log was from running at the command-line, so it seems to just confirm that what you said earlier is true. I'm sure I'm missing something, but I can't see anything wrong with what you posted - no errors, no problems.

----------

## lxnay

no errors, no problems but ports:

```
8009/tcp open  ajp13

8080/tcp open  http-proxy
```

aren't opened.

I have to run an xterm and type

```
/etc/init.d/tomcat-5 restart
```

to truly start tomcat

----------

## rex123

Perhaps it would be useful to do this:

Stop tomcat; remove catalina.out; reboot.

Then look at the catalina.out file before you do that xterm command. It should tell you if there's some reason why it's failing to bind to its ports.

Then do the xterm command, and look at catalina.out again.

I still (perhaps rather unfairly) suspect that tomcat is not in your default runlevel.

----------

## lxnay

thank you very much rex123 for your help:

There's something strange, here the clean boot log:

```
18:13:26,260  INFO Http11Protocol:142 - Initializing Coyote HTTP/1.1 on http-8080

18:13:26,341  INFO Catalina:514 - Initialization processed in 969 ms

18:13:26,391  INFO StandardService:472 - Starting service Catalina

18:13:26,399  INFO StandardEngine:467 - Starting Servlet Engine: Apache Tomcat/5.0

18:13:26,539  INFO StandardHost:787 - XML validation disabled

18:13:26,602  INFO StandardHost:1024 - Create Host deployer for direct deployment ( non-jmx )

18:13:26,610  INFO StandardHostDeployer:435 - Processing Context configuration file URL file:/etc/tomcat-5/default/Catalina/localhost/manager.xml

18:13:27,589  INFO StandardHostDeployer:435 - Processing Context configuration file URL file:/etc/tomcat-5/default/Catalina/localhost/admin.xml

18:13:27,910  INFO PropertyMessageResources:127 - Initializing, config='org.apache.struts.util.LocalStrings', returnNull=true

18:13:27,911  INFO PropertyMessageResources:127 - Initializing, config='org.apache.struts.action.ActionResources', returnNull=true

18:13:28,501  INFO PropertyMessageResources:127 - Initializing, config='org.apache.webapp.admin.ApplicationResources', returnNull=true

18:13:30,331  INFO StandardHostDeployer:197 - Installing web application at context path /servlet from URL file:/var/lib/tomcat-5/default/webapps/servlet

18:13:30,753  INFO StandardHostDeployer:197 - Installing web application at context path /umin from URL file:/var/lib/tomcat-5/default/webapps/umin

18:13:31,066  INFO Http11Protocol:176 - Starting Coyote HTTP/1.1 on http-8080

18:13:31,148  INFO ChannelSocket:363 - JK2: ajp13 listening on /0.0.0.0:8009

18:13:31,152  INFO JkMain:355 - Jk running ID=0 time=17/21  config=/var/lib/tomcat-5/default/conf/jk2.properties

18:13:31,158  INFO Catalina:563 - Server startup in 4814 ms

18:13:36,238  INFO Http11Protocol:186 - Pausing Coyote HTTP/1.1 on http-8080

18:13:37,277  INFO StandardService:534 - Stopping service Catalina

18:13:37,278  INFO StandardHostDeployer:668 - Removing web application at context path /admin

18:13:37,300  INFO LoggerBase:514 - unregistering logger Catalina:type=Logger,path=/admin,host=localhost

18:13:37,305  INFO StandardHostDeployer:668 - Removing web application at context path /umin

18:13:37,308  INFO StandardHostDeployer:668 - Removing web application at context path /servlet

18:13:37,313  INFO StandardHostDeployer:668 - Removing web application at context path /manager

18:13:37,322  INFO LoggerBase:514 - unregistering logger Catalina:type=Logger,host=localhost

18:13:37,323  INFO LoggerBase:514 - unregistering logger Catalina:type=Logger

18:13:37,323  INFO Http11Protocol:200 - Stopping Coyote HTTP/1.1 on http-8080

```

----------

## lxnay

This is the tomcat-5 default init script:

```
#!/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.28/tomcat.init,v 1.3 2005/03/28 03:14:47 luckyduck Exp $

depend() {

        use dns logger mysql postgresql net

        after apache2

}

start() {

        ebegin "Starting Tomcat"

        cd ${CATALINA_BASE}/webapps

        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 $?

}
```

If you compare it to the log time, you'll notice that after 5 seconds, tomcat is stopped by something

----------

## lxnay

 *lxnay wrote:*   

> This is the tomcat-5 default init script:
> 
> ```
> #!/sbin/runscript
> 
> ...

 

and that's catalina.sh:

```

#!/bin/sh

# -----------------------------------------------------------------------------

# Start/Stop Script for the CATALINA Server

#

# Environment Variable Prequisites

#

#   CATALINA_HOME   May point at your Catalina "build" directory.

#

#   CATALINA_BASE   (Optional) Base directory for resolving dynamic portions

#                   of a Catalina installation.  If not present, resolves to

#                   the same directory that CATALINA_HOME points to.

#

#   CATALINA_OPTS   (Optional) Java runtime options used when the "start",

#                   "stop", or "run" command is executed.

#

#   CATALINA_TMPDIR (Optional) Directory path location of temporary directory

#                   the JVM should use (java.io.tmpdir).  Defaults to

#                   $CATALINA_BASE/temp.

#

#   JAVA_HOME       Must point at your Java Development Kit installation.

#

#   JAVA_OPTS       (Optional) Java runtime options used when the "start",

#                   "stop", or "run" command is executed.

#

#   JPDA_TRANSPORT  (Optional) JPDA transport used when the "jpda start"

#                   command is executed. The default is "dt_socket".

#

#   JPDA_ADDRESS    (Optional) Java runtime options used when the "jpda start"

#                   command is executed. The default is 8000.

#

#   JSSE_HOME       (Optional) May point at your Java Secure Sockets Extension

#                   (JSSE) installation, whose JAR files will be added to the

#                   system class path used to start Tomcat.

#

#   CATALINA_PID    (Optional) Path of the file which should contains the pid

#                   of catalina startup java process, when start (fork) is used

#

# $Id: catalina.sh,v 1.13.2.1 2004/08/21 15:49:49 yoavs Exp $

# -----------------------------------------------------------------------------

# source the appropriate files right away

source /etc/profile

source /etc/conf.d/tomcat-5

# OS specific support.  $var _must_ be set to either true or false.

cygwin=false

os400=false

case "`uname`" in

CYGWIN*) cygwin=true;;

OS400*) os400=true;;

esac

# resolve links - $0 may be a softlink

PRG="$0"

while [ -h "$PRG" ]; do

  ls=`ls -ld "$PRG"`

  link=`expr "$ls" : '.*-> \(.*\)$'`

  if expr "$link" : '.*/.*' > /dev/null; then

    PRG="$link"

  else

    PRG=`dirname "$PRG"`/"$link"

  fi

done

# Get standard environment variables

PRGDIR=`dirname "$PRG"`

# Only set CATALINA_HOME if not already set

[ -z "$CATALINA_HOME" ] && CATALINA_HOME=`cd "$PRGDIR/.." ; pwd`

if [ -r "$CATALINA_HOME"/bin/setenv.sh ]; then

  . "$CATALINA_HOME"/bin/setenv.sh

fi

# For Cygwin, ensure paths are in UNIX format before anything is touched

if $cygwin; then

  [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`

  [ -n "$CATALINA_HOME" ] && CATALINA_HOME=`cygpath --unix "$CATALINA_HOME"`

  [ -n "$CATALINA_BASE" ] && CATALINA_BASE=`cygpath --unix "$CATALINA_BASE"`

  [ -n "$CLASSPATH" ] && CLASSPATH=`cygpath --path --unix "$CLASSPATH"`

  [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --unix "$JSSE_HOME"`

fi

# For OS400

if $os400; then

  # Set job priority to standard for interactive (interactive - 6) by using

  # the interactive priority - 6, the helper threads that respond to requests

  # will be running at the same priority as interactive jobs.

  COMMAND='chgjob job('$JOBNAME') runpty(6)'

  system $COMMAND

  # Enable multi threading

  export QIBM_MULTI_THREADED=Y

fi

# Get standard Java environment variables

if [ -r "$CATALINA_HOME"/bin/setclasspath.sh ]; then

  BASEDIR="$CATALINA_HOME"

  . "$CATALINA_HOME"/bin/setclasspath.sh

else

  echo "Cannot find $CATALINA_HOME/bin/setclasspath.sh"

  echo "This file is needed to run this program"

  exit 1

fi

# Add on extra jar files to CLASSPATH

if [ -n "$JSSE_HOME" ]; then

  CLASSPATH="$CLASSPATH":"$JSSE_HOME"/lib/jcert.jar:"$JSSE_HOME"/lib/jnet.jar:"$JSSE_HOME"/lib/jsse.jar

fi

CLASSPATH="$CLASSPATH":"$CATALINA_HOME"/bin/bootstrap.jar:`java-config -p commons-logging`:`java-config -p log4j`

if [ -z "$CATALINA_BASE" ] ; then

  CATALINA_BASE="$CATALINA_HOME"

fi

if [ -z "$CATALINA_TMPDIR" ] ; then

  # Define the java.io.tmpdir to use for Catalina

  CATALINA_TMPDIR="$CATALINA_BASE"/temp

fi

# For Cygwin, switch paths to Windows format before running java

if $cygwin; then

  JAVA_HOME=`cygpath --absolute --windows "$JAVA_HOME"`

  CATALINA_HOME=`cygpath --absolute --windows "$CATALINA_HOME"`

  CATALINA_BASE=`cygpath --absolute --windows "$CATALINA_BASE"`

  CATALINA_TMPDIR=`cygpath --absolute --windows "$CATALINA_TMPDIR"`

  CLASSPATH=`cygpath --path --windows "$CLASSPATH"`

  [ -n "$JSSE_HOME" ] && JSSE_HOME=`cygpath --absolute --windows "$JSSE_HOME"`

  JAVA_ENDORSED_DIRS=`cygpath --path --windows "$JAVA_ENDORSED_DIRS"`

fi

# ----- Execute The Requested Command -----------------------------------------

echo "Using CATALINA_BASE:   $CATALINA_BASE"

echo "Using CATALINA_HOME:   $CATALINA_HOME"

echo "Using CATALINA_TMPDIR: $CATALINA_TMPDIR"

echo "Using JAVA_HOME:       $JAVA_HOME"

if [ "$1" = "jpda" ] ; then

  if [ -z "$JPDA_TRANSPORT" ]; then

    JPDA_TRANSPORT="dt_socket"

  fi

  if [ -z "$JPDA_ADDRESS" ]; then

    JPDA_ADDRESS="8000"

  fi

  if [ -z "$JPDA_OPTS" ]; then

    JPDA_OPTS="-Xdebug -Xrunjdwp:transport=$JPDA_TRANSPORT,address=$JPDA_ADDRESS,server=y,suspend=n"

  fi

  CATALINA_OPTS="$CATALINA_OPTS $JPDA_OPTS"

  shift

fi

if [ "$1" = "debug" ] ; then

  if $os400; then

    echo "Debug command not available on OS400"

    exit 1

  else

    shift

    if [ "$1" = "-security" ] ; then

      echo "Using Security Manager"

      shift

      exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \

        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

        -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \

        -Djava.security.manager \

        -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \

        -Dcatalina.base="$CATALINA_BASE" \

        -Dcatalina.home="$CATALINA_HOME" \

        -Djava.io.tmpdir="$CATALINA_TMPDIR" \

        org.apache.catalina.startup.Bootstrap "$@" start

    else

      exec "$_RUNJDB" $JAVA_OPTS $CATALINA_OPTS \

        -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

        -sourcepath "$CATALINA_HOME"/../../jakarta-tomcat-catalina/catalina/src/share \

        -Dcatalina.base="$CATALINA_BASE" \

        -Dcatalina.home="$CATALINA_HOME" \

        -Djava.io.tmpdir="$CATALINA_TMPDIR" \

        org.apache.catalina.startup.Bootstrap "$@" start

    fi

  fi

elif [ "$1" = "run" ]; then

  shift

  if [ "$1" = "-security" ] ; then

    echo "Using Security Manager"

    shift

    exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \

      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

      -Djava.security.manager \

      -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMPDIR" \

      org.apache.catalina.startup.Bootstrap "$@" start

  else

    exec "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \

      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMPDIR" \

      org.apache.catalina.startup.Bootstrap "$@" start

  fi

elif [ "$1" = "start" ] ; then

  shift

  touch "$CATALINA_BASE"/logs/catalina.out

  if [ "$1" = "-security" ] ; then

    echo "Using Security Manager"

    shift

    "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \

      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

      -Djava.security.manager \

      -Djava.security.policy=="$CATALINA_BASE"/conf/catalina.policy \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMPDIR" \

      org.apache.catalina.startup.Bootstrap "$@" start \

      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &

      if [ ! -z "$CATALINA_PID" ]; then

        echo $! > $CATALINA_PID

      fi

  else

    "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \

      -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

      -Dcatalina.base="$CATALINA_BASE" \

      -Dcatalina.home="$CATALINA_HOME" \

      -Djava.io.tmpdir="$CATALINA_TMPDIR" \

      org.apache.catalina.startup.Bootstrap "$@" start \

      >> "$CATALINA_BASE"/logs/catalina.out 2>&1 &

      if [ ! -z "$CATALINA_PID" ]; then

        echo $! > $CATALINA_PID

      fi

  fi

elif [ "$1" = "stop" ] ; then

  shift

  FORCE=0

  if [ "$1" = "-force" ]; then

    shift

    FORCE=1

  fi

  "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \

    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \

    -Dcatalina.base="$CATALINA_BASE" \

    -Dcatalina.home="$CATALINA_HOME" \

    -Djava.io.tmpdir="$CATALINA_TMPDIR" \

    org.apache.catalina.startup.Bootstrap "$@" stop

  if [ $FORCE -eq 1 ]; then

    if [ ! -z "$CATALINA_PID" ]; then

       echo "Killing: `cat $CATALINA_PID`"

       kill -9 `cat $CATALINA_PID`

    fi

  fi

elif [ "$1" = "version" ] ; then

    "$_RUNJAVA"   \

      -classpath "$CATALINA_HOME/server/lib/catalina.jar" \

      org.apache.catalina.util.ServerInfo

else

  echo "Usage: catalina.sh ( commands ... )"

  echo "commands:"

  if $os400; then

    echo "  debug             Start Catalina in a debugger (not available on OS400)"

    echo "  debug -security   Debug Catalina with a security manager (not available on OS400)"

  else

    echo "  debug             Start Catalina in a debugger"

    echo "  debug -security   Debug Catalina with a security manager"

  fi

  echo "  jpda start        Start Catalina under JPDA debugger"

  echo "  run               Start Catalina in the current window"

  echo "  run -security     Start in the current window with security manager"

  echo "  start             Start Catalina in a separate window"

  echo "  start -security   Start in a separate window with security manager"

  echo "  stop              Stop Catalina"

  echo "  stop -force       Stop Catalina (followed by kill -KILL)"

  echo "  version           What version of tomcat are you running?"

  exit 1

fi

```

----------

## rex123

I'm running tomcat 5.0.27; you're running 5.0.28, which is keyword-masked.

One difference seems to be that your files are referred to as tomcat-5, while mine are tomcat5 (no hyphen).

Is it possible that this is causing confusion (your very first post refers to tomcat5, but the rest refer to tomcat-5)?

What does 

```
rc-update show
```

 give? It might be worth having a look in /etc/conf.d/tomcat5 and /etc/conf.d/tomcat-5 as well. Also it might be interesting to see what /etc/init.d/tomcat-5 status and /etc/init.d/tomcat5/status show directly after boot.

But this is all clutching at straws. I really don't know why tomcat should start then immediately stop during boot.

----------

## lxnay

months are past and still the same damned problem. After root login from console, if I restart tomcat, it loads everything without any problem. Is that a PAM problem?

----------

## lxnay

I've updated the topic  :Wink: 

----------

