File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse Integrated with Tomcat for Hot Deployment Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse Integrated with Tomcat for Hot Deployment" Watch "Eclipse Integrated with Tomcat for Hot Deployment" New topic
Author

Eclipse Integrated with Tomcat for Hot Deployment

Ashok Jag
Greenhorn

Joined: Sep 21, 2005
Posts: 18
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

Joined: Jul 11, 2001
Posts: 14112
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.


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Ashok Jag
Greenhorn

Joined: Sep 21, 2005
Posts: 18
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

Joined: Jul 11, 2001
Posts: 14112
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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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!


Customer surveys are for companies who didn't pay proper attention to begin with.
Ashok Jag
Greenhorn

Joined: Sep 21, 2005
Posts: 18
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

Joined: Sep 21, 2005
Posts: 18
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

Joined: Jun 25, 2001
Posts: 16228
    
  21

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

Joined: Sep 21, 2005
Posts: 18
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse Integrated with Tomcat for Hot Deployment