tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Costin Manolache" <cos...@gmail.com>
Subject Re: How to reload web app from java program?
Date Mon, 05 May 2008 03:21:00 GMT
On Sun, May 4, 2008 at 1:09 PM, <milos@grf.bg.ac.yu> wrote:

> > David Smith wrote:
> >> But to use the api that the manager app uses, your webapp needs to have
> >> privileged="true" set in the context first.  Second, look at the source
> >> for the manager webapp for exactly what it does.  And lastly, notice
> the
> >> manager webapp can't reload itself -- I suspect there's a reason for
> >> that.
> >> I'm not sure a webapp being reloaded can request the manager reload it
> >> as the manager does it during the request and doesn't send a response
> >> until the reload is complete.  If you have code that can't unload
> >> because it's actively being executed, it might block the reload.
> >
> > If you have autoDeploy set to true on the host, one quick and dirty hack
> > around this would be to touch the web.xml file. It has the advantage of
> > de-coupling the reload of the webapp from the request you use to trigger
> > it. On the down side, it requires you to be using unpacked web apps and
> > the
> > reload won't be instant.
> >
> > Mark
>
> Thanks Mark,
> I also came to this idea but I wanted to check if there is a cleaner way
> (using some API) to do this. Concerning my specific web app, there is no
> problem related to packing/unpacking and even the delay between touching
> web.xml and reloading is not important (if that happens at least after few
> minutes).
>

The API is JMX - you need to get the mbean server ( findMBeanServer() ),
then invoke 'reload'
on your webapp. The object name as specified by JSR77 ( I think) looks like:

default:j2eeType=WebModule,name=//localhost/examples,J2EEApplication=none,J2EEServer=none


Costin



> Milos
>
> >
> > ---------------------------------------------------------------------
> > 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
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message