• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

How to change tomcat server.xml programatically.  RSS feed

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • 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: 20657
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • 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
  • 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: 20657
122
Android Eclipse IDE Java Linux Redhat Tomcat Server
  • Mark post as helpful
  • send pies
  • 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).
 
Brace yourself while corporate america tries to sell us its things. Some day they will chill and use tiny ads.
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!