On 24/11/2010 17:15, Rob Gregory wrote:
> Thanks Pid, see my comment below:-
> 
>> -----Original Message-----
>> From: Pid [mailto:p...@pidster.com]
>> Sent: 24 November 2010 17:05
>> To: Tomcat Users List
>> Subject: Re: Starup Order [Filters --> Servlets --> Context]
>>
>> On 24/11/2010 15:38, Rob Gregory wrote:
>>> Hi Guys,
>>>
>>> Am I correct in my assumption that servlet filters are started
> before
>>> servlets and that the context listeners are not fired until both the
>>> filters and servlets have been initialised?
>>
>> ServletContextListeners first, before Filters & Servlets.
> 
> Ah, I was confusing the events being fired to the actual initialisation
> of the ServletContextListeners.
> 
>>> What I am trying to do is
>>> run some code before the context is started which is actually going
> to
>>> copy a mycontext.xml into another mysecondcontext.xml (using
>>> docBase="single_webapp_location"). which would then get auto
> deployed
>>> into Tomcat creating the 2nd context.
>>
>> I'm not sure that's such a good idea.
> 
> Is there a specific reason why not? How is doing this any different to
> manually creating the two context.xml files if I can create them before
> the contexts are initialised?

The deployment cycle is single threaded, the SCLs execute sequentially
in order of definition in each application.

If the SCL throws an uncaught exception, then the app won't start up at all.

Does it need to happen in an SCL?


>>> As part of this process I also
>>> need to copy some files from a 'location' into the docBase and
> suspect
>>> that this will cause Tomcat to reload both contexts.
>>
>> Depends how you're configured.  It might.
> 
> I have a number of watched resources so I think it will unless I can
> copy the files before the contexts are initialised.

If you're watching the file that gets copied, then yes, it'll cause a
redeployment of app1, & consequently of app2.

Are you watching that file?


p


>>> Is there any entry point during Tomcat startup where I can do some
>>> work before either contexts are started?
>>
>> LifecycleListener?
>> Look for examples at the beginning of server.xml.
> 
> Thanks for the pointer Pid. Most helpful. 
> 
>>
>>
>> p
>>
>>> Tomcat is 6.0.29 under JDK 1.6
>>>
>>>
>>>
>>> Thanks for any assistance.
>>>
>>> Rob
>>>
>>>
>>>
>>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
> 

Attachment: 0x62590808.asc
Description: application/pgp-keys

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to