You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Adi Katz <ad...@easa.aeat.com> on 2003/06/04 16:08:54 UTC

changing tomcat configuration on the fly

Hello,

I am interested in changing the server.xml and web.xml files through
servlets and then reload them.
So for example I can add JNDI entries in server.xml without the nedd to
stop/start tomcat again.
Something very similar is done in the admin app ( shipped with tomcat ).
Does anybody have a code example or some tips on how to do it ??

Thanks,
Adi


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: changing tomcat configuration on the fly

Posted by Justin Ruthenbeck <ju...@nextengine.com>.
Depending on the functionality of your app, what you need to do with these 
databases, and your comfort level in coding this stuff, why not role your own?

It may be possible to tweak Tomcat to do something like this, but in 
odd-ball situations like this one, I tend to trust my own ability to code 
something rather than relying on someone else's app to do something it 
wasn't designed to do.  Others may disagree on that point, but it's worth 
considering.  You're gonna be coding/configuring with Tomcat-specific stuff 
here, so you're opening up to future compatibility problems (with other 
Tomcat versions).  You may even be able to use some of Tomcat's codebase to 
help with the db organization.

... Some thoughts wafting through the virtual air ...

justin


At 11:13 AM 6/4/2003, you wrote:
>Hello Tim,
>
>I have only one app and users should be able to register a database with the
>app.
>so:
>1) I dont know in advance what kind of data base it will be
>2) data supplied by the end user regarding the database / url etc. should be
>written to the right files ( server.xml ).
>3) In order for tomcat to update according to the changes made... the all
>thing need to restart and I cant relay on somebodey going to the server and
>stop-start tomcat.
>
>Would like to hear any ideas /examples.
>
>Adi
>
>-----Original Message-----
>From: Tim Shaw [mailto:tim@everserve.co.uk]
>Sent: 04 June 2003 18:48
>To: Tomcat Users List
>Subject: Re: changing tomcat configuration on the fly
>
>
>I wonder whether you actually want this approach at all.
>
>Depending on why you want to modify JNDI entries, and whether this is
>for the entire server or just a specific web-app ...
>
>If I need to change my JNDI entries (generally values and additions
>during development), I modify the context.xml file for the app (in the
>META-INF directory) and redeploy the app. This seems to automagically
>modify the server.xml file for me, and I can keep the changes in my web
>app CVS.
>
>Perhaps your needs are more complex ...
>
>G'luck
>
>tim
>
>Tim Funk wrote:
> > There is no way to change web.xml on the fly. Except by -
> > - putting a new web.xml in its place
> > - stop the app
> > - start the app
> >
> > As for changes to server.xml. This can be done via JMX. See the code to
> > the admin app on how make changes.
> >
> > -Tim
> >
> > Adi Katz wrote:
> >
> >> Hello,
> >>
> >> I am interested in changing the server.xml and web.xml files through
> >> servlets and then reload them.
> >> So for example I can add JNDI entries in server.xml without the nedd to
> >> stop/start tomcat again.
> >> Something very similar is done in the admin app ( shipped with tomcat ).
> >> Does anybody have a code example or some tips on how to do it ??
> >>
> >> Thanks,
> >> Adi
> >>
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> >
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


____________________________________
Justin Ruthenbeck
Software Engineer, NextEngine Inc.
justinr - AT - nextengine DOT com
Confidential
    See http://www.nextengine.com/confidentiality.php
____________________________________


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: changing tomcat configuration on the fly

Posted by Tim Shaw <ti...@everserve.co.uk>.
If it's a 'single-shot' user accessing a DB known to them (and for many 
you could configure) I'd probably take request parameters and set up a 
DataSource in-session. This could be made 'longer lasting' by 
loading/storing the data entered - but users would still have to select 
the configuration they want ....
If it's an admin task for a single DB (and not frequent or when users 
are working!) I'd probably script an update/redeploy of the app itself.

Others may not ... ;-)

tim

Adi Katz wrote:
> Hello Tim,
> 
> I have only one app and users should be able to register a database with the
> app.
> so:
> 1) I dont know in advance what kind of data base it will be
> 2) data supplied by the end user regarding the database / url etc. should be
> written to the right files ( server.xml ).
> 3) In order for tomcat to update according to the changes made... the all
> thing need to restart and I cant relay on somebodey going to the server and
> stop-start tomcat.
> 
> Would like to hear any ideas /examples.
> 
> Adi
> 
> -----Original Message-----
> From: Tim Shaw [mailto:tim@everserve.co.uk]
> Sent: 04 June 2003 18:48
> To: Tomcat Users List
> Subject: Re: changing tomcat configuration on the fly
> 
> 
> I wonder whether you actually want this approach at all.
> 
> Depending on why you want to modify JNDI entries, and whether this is
> for the entire server or just a specific web-app ...
> 
> If I need to change my JNDI entries (generally values and additions
> during development), I modify the context.xml file for the app (in the
> META-INF directory) and redeploy the app. This seems to automagically
> modify the server.xml file for me, and I can keep the changes in my web
> app CVS.
> 
> Perhaps your needs are more complex ...
> 
> G'luck
> 
> tim
> 
> Tim Funk wrote:
> 
>>There is no way to change web.xml on the fly. Except by -
>>- putting a new web.xml in its place
>>- stop the app
>>- start the app
>>
>>As for changes to server.xml. This can be done via JMX. See the code to
>>the admin app on how make changes.
>>
>>-Tim
>>
>>Adi Katz wrote:
>>
>>
>>>Hello,
>>>
>>>I am interested in changing the server.xml and web.xml files through
>>>servlets and then reload them.
>>>So for example I can add JNDI entries in server.xml without the nedd to
>>>stop/start tomcat again.
>>>Something very similar is done in the admin app ( shipped with tomcat ).
>>>Does anybody have a code example or some tips on how to do it ??
>>>
>>>Thanks,
>>>Adi
>>>
>>
>>
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>>
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


RE: changing tomcat configuration on the fly

Posted by Adi Katz <ad...@easa.aeat.com>.
Hello Tim,

I have only one app and users should be able to register a database with the
app.
so:
1) I dont know in advance what kind of data base it will be
2) data supplied by the end user regarding the database / url etc. should be
written to the right files ( server.xml ).
3) In order for tomcat to update according to the changes made... the all
thing need to restart and I cant relay on somebodey going to the server and
stop-start tomcat.

Would like to hear any ideas /examples.

Adi

-----Original Message-----
From: Tim Shaw [mailto:tim@everserve.co.uk]
Sent: 04 June 2003 18:48
To: Tomcat Users List
Subject: Re: changing tomcat configuration on the fly


I wonder whether you actually want this approach at all.

Depending on why you want to modify JNDI entries, and whether this is
for the entire server or just a specific web-app ...

If I need to change my JNDI entries (generally values and additions
during development), I modify the context.xml file for the app (in the
META-INF directory) and redeploy the app. This seems to automagically
modify the server.xml file for me, and I can keep the changes in my web
app CVS.

Perhaps your needs are more complex ...

G'luck

tim

Tim Funk wrote:
> There is no way to change web.xml on the fly. Except by -
> - putting a new web.xml in its place
> - stop the app
> - start the app
>
> As for changes to server.xml. This can be done via JMX. See the code to
> the admin app on how make changes.
>
> -Tim
>
> Adi Katz wrote:
>
>> Hello,
>>
>> I am interested in changing the server.xml and web.xml files through
>> servlets and then reload them.
>> So for example I can add JNDI entries in server.xml without the nedd to
>> stop/start tomcat again.
>> Something very similar is done in the admin app ( shipped with tomcat ).
>> Does anybody have a code example or some tips on how to do it ??
>>
>> Thanks,
>> Adi
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: changing tomcat configuration on the fly

Posted by Tim Shaw <ti...@everserve.co.uk>.
I wonder whether you actually want this approach at all.

Depending on why you want to modify JNDI entries, and whether this is 
for the entire server or just a specific web-app ...

If I need to change my JNDI entries (generally values and additions 
during development), I modify the context.xml file for the app (in the 
META-INF directory) and redeploy the app. This seems to automagically 
modify the server.xml file for me, and I can keep the changes in my web 
app CVS.

Perhaps your needs are more complex ...

G'luck

tim

Tim Funk wrote:
> There is no way to change web.xml on the fly. Except by -
> - putting a new web.xml in its place
> - stop the app
> - start the app
> 
> As for changes to server.xml. This can be done via JMX. See the code to 
> the admin app on how make changes.
> 
> -Tim
> 
> Adi Katz wrote:
> 
>> Hello,
>>
>> I am interested in changing the server.xml and web.xml files through
>> servlets and then reload them.
>> So for example I can add JNDI entries in server.xml without the nedd to
>> stop/start tomcat again.
>> Something very similar is done in the admin app ( shipped with tomcat ).
>> Does anybody have a code example or some tips on how to do it ??
>>
>> Thanks,
>> Adi
>>  
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: changing tomcat configuration on the fly

Posted by Tim Funk <fu...@joedog.org>.
There is no way to change web.xml on the fly. Except by -
- putting a new web.xml in its place
- stop the app
- start the app

As for changes to server.xml. This can be done via JMX. See the code to the 
admin app on how make changes.

-Tim

Adi Katz wrote:
> Hello,
> 
> I am interested in changing the server.xml and web.xml files through
> servlets and then reload them.
> So for example I can add JNDI entries in server.xml without the nedd to
> stop/start tomcat again.
> Something very similar is done in the admin app ( shipped with tomcat ).
> Does anybody have a code example or some tips on how to do it ??
> 
> Thanks,
> Adi
>  


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: changing tomcat configuration on the fly

Posted by Dominic Parry <do...@rucus.ru.ac.za>.
you can find it in the Tomcat source. Just look in the source for the admin app.
  ----- Original Message ----- 
  From: Adi Katz 
  To: tomcat-user@jakarta.apache.org 
  Sent: Wednesday, June 04, 2003 4:08 PM
  Subject: changing tomcat configuration on the fly


  Hello,

  I am interested in changing the server.xml and web.xml files through
  servlets and then reload them.
  So for example I can add JNDI entries in server.xml without the nedd to
  stop/start tomcat again.
  Something very similar is done in the admin app ( shipped with tomcat ).
  Does anybody have a code example or some tips on how to do it ??

  Thanks,
  Adi


  ---------------------------------------------------------------------
  To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
  For additional commands, e-mail: tomcat-user-help@jakarta.apache.org