Tomcat will (upon startup) scan the appBase="..." directory (default is
'webapps') by default and will load any web applications located there. In
addition if you have a context defined, it will also load the app again!

Try placing your web application some other place but 'webapps' and make
sure you specify the absolute path in the docBase of your context tag.

Michael Petres
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
InnovObjX Corp.
Web: www.innovobjx.com
Tel: 905-729-2235 x3
Fax: 905-729-2235
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

-----Original Message-----
From: Jeff Wishnie [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, September 10, 2002 6:53 PM
To: Tomcat Users List
Subject: Servlet's loading twice on start-up--DRIVING ME NUTS!

I have a very simple Tomcat install with one application. The web.xml for
the applicaiton loads two servlets on start-up.

According to my logs both servlets have their init() methods called _twice_.

I've looked through the list archives and gone through the mentionned causes
of this problem and, assuming I understand the issues, have ruled them out.

1. The servlets are _not_ throwing exceptions

2. I have only _one_ context defined in server.xml and it is _not_ the
default context.

I'm going nuts here and would be very grateful for any help folks on the
list can provide.

Here are the details of my set-up:

Tomcat: 4.1.7-LE
JDK: 1.4.0_01
OS: Redhat 7.2

Tomcat layout:

One web application in: $TOMCAT_HOME/ROOT/MyApp

Here are revelant sections from $TOMCAT_HOME/conf/server.xml:

  <Host name="localhost" debug="0" appBase="ROOT" unpackWARs="true"
autoDeploy="false">
        <Logger className="org.apache.catalina.logger.FileLogger"
                 directory="logs"  prefix="localhost_log." suffix=".txt"
                timestamp="true"/>
        <Context path="/" docBase="DeluxeCal" debug="0" crossContext="false"
reloadable="false" />
  </Host>

[note that "autoDeploy" and "reloadable" are false and that the Context
path="/", _not_ ""]

Here are relevent sections from  $TOMCAT_HOME/ROOT/MyApp/WEB-INF/web,xml:

 <servlet>
        <servlet-name>initServlet</servlet-name>
        <servlet-class>com.foo.InitServlet</servlet-class>
        <load-on-startup>10</load-on-startup>
    </servlet>

    <servlet>
        <servlet-name>serviceInit</servlet-name>
        <servlet-class>com.foo.ServiceInitServlet</servlet-class>
        <init-param>
            <param-name>endpoint</param-name>
            <param-value>http://foo.com/service/bar?wsdl</param-value>
        </init-param>
        <load-on-startup>20</load-on-startup>
    </servlet>

Why is Init getting called TWICE for each servlet??

Help!

Thanks!

- Jeff


--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to