• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to change tomcat server.xml programatically.

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi I want to change tomcat-server.xml of embedded tomcat in Virgo programatically. What are the possible options for that?
Is there a way/ API through which I can change the tomcat server.xml through coding?
We just need to know if there is a way for parsing + modification through the configurations APIs of Apache/tomcat (if there is any)
thanks!!

 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Embedded Tomcat typically doesn't use tomcat-server.xml, because the embedded Tomcat is a JavaBean and it is configured using POJO properties on the Tomcat bean. Which is basically what tomcat-server.xml is for - it's a set of specifications for configuring the Tomcat startup.

So the answer to your question depends on how Virgo configures Tomcat. I've never heard of Virgo, myself, though.
 
anushka vaze
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In general how can I get the control to change the connector attributes from tomcat server.xml like port timeout etc through API.
Are there any exposed API if I have the handle to read the server.xml.
My moto is to chnage the server.xml programatically which will allow me to call APIs like setPort() or setConnectionTimeout() etc which will change the setting for tomcat server. This can be static or dynamic in whichever way it is possible.
If it works for standalone tomcat , possibly it will work for Virgo Tomcat Server as well which is nothibg but the OSGi implementation of Equinox giving a support for tomcat through embedding it in Virgo.

Please let me know if there is a way to get the handle of the tomcat server or some of the configuration related classes of tomcat and which can be changed programatically.

Thanks!!
 
Tim Holloway
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Server.xml is digested and processed when Tomcat starts up and ignored until the next startup, so changing it for the purpose of dynamically modifying Tomcat is futile - that's why you're not supposed to put Context elements in server.xml.

Once Tomcat is running, an embedded Tomcat is a JavaBean and you dynamically modify it using the bean methods. This, of course, supposes that you own the bean.

For external dynamic controls, there are several interfaces, including JMX, JSR-77, JSR-88 (and their successors), the Tomcat management webapps (if installed).
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic