Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 96555 invoked from network); 26 Jun 2006 00:40:30 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 26 Jun 2006 00:40:30 -0000 Received: (qmail 94635 invoked by uid 500); 26 Jun 2006 00:40:18 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 94619 invoked by uid 500); 26 Jun 2006 00:40:17 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 94608 invoked by uid 99); 26 Jun 2006 00:40:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jun 2006 17:40:17 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_HELO_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy) Received: from [205.237.194.35] (HELO mxout-04.mxes.net) (205.237.194.35) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 25 Jun 2006 17:40:17 -0700 Received: from [192.168.1.100] (unknown [69.233.32.55]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.mxes.net (Postfix) with ESMTP id 15CE4A3295 for ; Sun, 25 Jun 2006 20:39:55 -0400 (EDT) Message-ID: <449F2CD6.9020007@globalmentor.com> Date: Sun, 25 Jun 2006 17:39:50 -0700 From: Garret Wilson Organization: GlobalMentor, Inc. User-Agent: Thunderbird 1.5.0.4 (Windows/20060516) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: Tomcat multiple init(), no init param References: <449F00DA.6000508@globalmentor.com> <449F23AE.9050904@globalmentor.com> In-Reply-To: <449F23AE.9050904@globalmentor.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Garret Wilson wrote: > It's as if two instances of Tomcat are being run in two separate JVMS: > one using the server.xml configuration, and another attempting to > deploy the .war files using some default configuration. The first set > of initialized servlets continue to run and accept connections. What's > wrong here? I've found the problem. If you remember, my server.xml had this: example.com Tomcat would deploy my .war file as specified, using the given init parameter. But then, because my .war file was in the appBase directory (here "/var/web/apps"), Tomcat would going through and deploying the .war file a second time even though autoDeploy was set to "false". One way to fix this it to change the appBase so that my .war file wasn't in the application base directory: example.com But the easier way is to add deployOnStartup="false" to the host configuration, like this: example.com Sure enough, there is a small note on this at http://tomcat.apache.org/tomcat-5.5-doc/config/host.html#Automatic%20Application%20Deployment : "When using automatic deployment, the docBase defined by an XML Context file should be outside of the appBase directory. If this is not the case difficulties may be experienced deploying the web application or the application may be deployed twice." Well, that's why I turned off autoDeploy---but it seems I need to turn off deployOnStartup as well. Garret > > Thanks in advance, > > Garret > > Garret Wilson wrote: >> Tomcat 5.5.16 seems to call a servlet's init() method several times, >> and the specific init parameter is missing in all but the first. >> >> I have a simple server.xml that includes: >> >> > unpackWARs="false" autoDeploy="false" >> xmlValidation="false" xmlNamespaceAware="false"> >> >> example.com >> >> >> > value="/var/web/data/www.example.com/"/> >> >> >> >> >> In www.example.com.war I have a web.xml file that includes two >> instances of MyServlet, with servlet names of myServlet1 and >> myServlet2, mapped to "/*" and "/example/*", respectively. >> >> Tomcat does the following, which I find odd: >> >> 1. myServlet1.init() is called. The init parameter "dataDirectory" is >> correctly set to "/var/web/data/www.example.com/". >> >> 2. catalina.out indicates "Jun 25, 2006 2:07:26 PM >> org.apache.catalina.startup.HostConfig deployWAR". >> >> 3. myServlet.init is called(). The init parameter "dataDirectory" >> returns null. >> >> 4. myServlet2.init is called(). The init parameter "dataDirectory" >> returns null. >> >> (Then steps 3 and 4 are repeated, presumably because steps 2 and 3 >> throw NullPointerExceptions, which results from the missing init >> parameter.) >> >> This confuses me: >> >> * Why is myServlet1.init() called twice? >> * Why isn't myServlet2.init() called before the second call to >> myServlet1.init()? >> * Why is the init parameter "dataDirectory" only available in the >> first call to myServlet1.init()? >> >> Thanks for any insight, >> >> Garret >> >> --------------------------------------------------------------------- >> To start a new topic, e-mail: users@tomcat.apache.org >> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org >> For additional commands, e-mail: users-help@tomcat.apache.org >> > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org