Tomcat initialising context twice, with autoDeploy turned off

W

Will

Hi,

I'm battling with a problem where my web app is being deployed twice
by tomcat. I've been through the documentation a number of times and
understand that if tomcat is set to use autodeployment, and if an
explicit context has been defined for the app (which it has)
deployment may very well happen twice if the WAR is placed inside the
appBase.

I have defined an explicit context for my app and placed it in:

$CATALINA_HOME/conf/[engine_name]/[host_name]

It looks like this:

<Context path="/sps" docBase="sps" unpackWAR="true"/>

But, I have turned off auto deployment for the localhost in the
server.xml:

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false" deployOnStartup="false"
xmlValidation="false" xmlNamespaceAware="false">

I have placed my WAR file inside the webapps directory.

However, I have a servlet context listener registered for my context
'sps' which is firing twice when tomcat starts up. Both times, the
ServletContextEvent that it receives in contextInitilized() is for the
'sps' context.

I've tried moving the WAR file outside of the webapps directory and
explicitly defining it's path in the context's docBase attribute, but
this makes no difference - I still see the context initialised twice.

This behaviour is the same on Tomcat 5.5.7 and 5.0.28.

Can anybody help me out here? I'm struggling to come up with an
answer.

Many thanks in advance,

Will
 
W

Will

Hi,

I'm battling with a problem where my web app is being deployed twice
by tomcat. I've been through the documentation a number of times and
understand that if tomcat is set to use autodeployment, and if an
explicit context has been defined for the app (which it has)
deployment may very well happen twice if the WAR is placed inside the
appBase.

I have defined an explicit context for my app and placed it in:

$CATALINA_HOME/conf/[engine_name]/[host_name]

It looks like this:

<Context path="/sps" docBase="sps" unpackWAR="true"/>

But, I have turned off auto deployment for the localhost in the
server.xml:

<Host name="localhost" appBase="webapps"
unpackWARs="true" autoDeploy="false" deployOnStartup="false"
xmlValidation="false" xmlNamespaceAware="false">

I have placed my WAR file inside the webapps directory.

However, I have a servlet context listener registered for my context
'sps' which is firing twice when tomcat starts up. Both times, the
ServletContextEvent that it receives in contextInitilized() is for the
'sps' context.

I've tried moving the WAR file outside of the webapps directory and
explicitly defining it's path in the context's docBase attribute, but
this makes no difference - I still see the context initialised twice.

This behaviour is the same on Tomcat 5.5.7 and 5.0.28.

Can anybody help me out here? I'm struggling to come up with an
answer.

Many thanks in advance,

Will


Problem resolved! It wasn't a problem with Tomcat after all - Tomcat
was behaving the way it should. The problem was my logging output -
what I was seeing in my logs, wasn't what actually was happening. Doh!

Right, where's that log4j book now...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top