• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse Integrated with Tomcat for Hot Deployment

 
Ashok Jag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,

I am looking to do a hot depolyment of WAR file using eclipse, right now I have integrated my project in Eclipse and configured eclipse too, but for every change I need to deploy a new WAR file and restart the tomcat server.

I have seen some topics on this, but not any concrete steps have been mentioned. I would like to know how configure a build paht for creating a WAR file from eclipse and then its does a hot deployment.

Appreciate your help!!

Thanks
Ashok

ps: I am not using MyEclipse, uisng Eclipse Europa 3.3.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using the sysdeo plugin, you don't even need to create a war file, let alone deploy it - tomcat runs directly on the Eclipse project.
 
Ashok Jag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for the reply.

I am using sysdeo plugin and configured tomcat using it, what I did was deployed the war file seperately under webapps folder of Tomcat and started Tomcat from Eclipse and I could see the console output though. Now, how could the eclipse deploy the changes made directly into Tomcat is there any configuration that I need to setup, to map it to the target folder under webapps. I am little dis-oriented here I feel.. Can you help me in throwing more light.

Thanks
Ashok
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The easiest way is to set up your project as a Tomcat Project. See http://javaboutique.internet.com/tutorials/three/index-4.html
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tomcat deployments don't have to be copied into the Tomcat webapps directory. All you have to do is define the application context to point to your Eclipse exploded WAR directory.

I hope by now everyone knows that it's better to define a webapp's context XML file in the Catalina/localhost config directory and NOT modify server.xml!
 
Ashok Jag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you so much Ilja Preuss for the timely input.
The URL provided me more insight, on what I need to do..basically with respect to the folder structure and placing the respective jsp, java , xml and properties files in a Tomcat Project.

I was able to configure properly now and run the project. Thanks Tim, for your input too.

Thanks
Ashok
 
Ashok Jag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was just carried away once the project was configured successfully :-). I have a question, I dont see my project folder under webapps directory , how does the Tomcat server picks it up and how does my project getting deployed, is it happening internally..curious to know?

I beleive answer is there in Tim's reply "All you have to do is define the application context to point to your Eclipse exploded WAR directory." but quiet not able to catch this point :-)

Thanks
Ashok
 
Tim Holloway
Saloon Keeper
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The location for deployed applications is not engraved in granite. There's a standard location for deployments for Tomcat, though this can be overridden in the server.xml file, and if I remember aright, it's CATLINA_HOME/conf/Catalina/localhost (or CATALINA_BASE, I can't remember which is which). You can deploy Tomcat applications by dropping xml files in that directory. These xml files consist of <Context> elements as defined in the Tomcat docs. Oh well, how about I read the docs: http://tomcat.apache.org/tomcat-5.5-doc/deployer-howto.html

The docBase for a Context Descriptor can be any locally-addressable filesystem path, so it's quite valid to use something like "ECLIPSE_HOME/workspace/project1/build/webapp1" to point to the exploded WAR.

Actual behavior varies from release to release, but Tomcat 5 copies the application WAR from the indicates docBase to the CATALINA_HOME/webapps directory (and explodes it if it's a WAR file and not a directory). Tomcat4 could handle unexploded WARs, but it didn't have the Catalina/localhost deployment directory. The context Descriptors were placed in CATALINA_HOME/webapps, where they had an unfortunate habit of colliding with other files.
 
Ashok Jag
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Tom.

Now I got a clear picture of how Tomcat picks up the project based on the <CONTEXT>, as you said it is better to have CONTEXT set in context.xml rather than in server.xml, even though it works right now..

Appreciate all your help!!

Thanks
Ashok
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic