• 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

[Tomcat] Dynamic Context?

 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Recently, I've changed the way I do development with Tomcat a bit. I used to write Ant deploy/undeploy/redeploy tasks and those worked great. What stunk was when I was stuck doing a bunch of JSP work and having to do a redeploy for every little CSS/Javascript change.

What I do now, is I create a context that points to my working project which is layed out just like a real deployed application. Works great with the context reloadable set to true. Problem is that when I start working on a different project, I have to go comment the context and create or uncomment the other one.

Is there anyway that I can tell tomcat to use a context on startup or something so I don't have to keep editing my server.xml? Utalizing the tomcat/conf/catalina/localhost/appname.xml context file doesn't help either. I have to go rename the context's that I want Tomcat to ignore and then rename the one I want Tomcat to load.

Thanks.
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not quite following. What prevents you from having multiple contexts, each with their own context xml file, and all laid out in the way you describe?
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You shouldn't have to edit server.xml at all.
Starting with version 5, Tomcat supports context fragment files which are just the context tag stored in a file named after your application.
These files are stored in {tomcat-install}/conf/Catalina/localhost.

If you remove this file for a particular application, Tomcat will undeploy that app. Likewise, putting it back, will re-deploy it.
[ December 18, 2006: Message edited by: Ben Souther ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ulf Dittmer:
I'm not quite following. What prevents you from having multiple contexts, each with their own context xml file, and all laid out in the way you describe?



Nothing, except I don't need to load 5 applications while I am working on one. You know, memory usage and all. ;)
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Ben Souther:
You shouldn't have to edit server.xml at all.
Starting with version 5, Tomcat supports context fragment files which are just the context tag stored in a file named after your application.
These files are stored in {tomcat-install}/conf/Catalina/localhost.

If you remove this file for a particular application, Tomcat will undeploy that app. Likewise, putting it back, will re-deploy it.

[ December 18, 2006: Message edited by: Ben Souther ]




Originally posted by Gregg Bolinger:
Utalizing the tomcat/conf/catalina/localhost/appname.xml context file doesn't help either. I have to go rename the context's that I want Tomcat to ignore and then rename the one I want Tomcat to load.



which I suppose I could create a script to do this and launch Tomcat, thus creating a dynamic context loader, in a sense. Just thought there might be something a bit more built in.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Missed that, sorry
[ December 18, 2006: Message edited by: Ben Souther ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would still like to be able to load a context or specify a context at runtime with Tomcat. I know that has to be possible because when you use Intellij's IDEA webapp deployment features, I believe it does this with the exploded directory for your webapp.

So if anyone has any ideas...
 
reply
    Bookmark Topic Watch Topic
  • New Topic