aspose file tools
The moose likes Tomcat and the fly likes Copying project from webapp folder to other tomcat server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Copying project from webapp folder to other tomcat server" Watch "Copying project from webapp folder to other tomcat server" New topic

Copying project from webapp folder to other tomcat server

Jay Shukla

Joined: Jan 22, 2008
Posts: 10
Hi All,

This is little different scenario. (might not be the correct approach but no other option due to project deadline).

I have 2 server on which tomcat is installed.

Out of 2 one of the tomcat has working project which is under webapps folder. I need to move this folder along with its subfolders - subfiles to other tomcat under webapps folder.

Could anyone please let me know how to do this?

Is it something like stop tomcat copy project folder from webapps and paste under other tomcat server and start instance?

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 62501

If the web app is properly structured you should just be able to copy the context root folder to webapps. (Assuming you are deploying to webapps.)

Do you not have a packaged war file for the original deployment? If not, why not?

(If the web app depends upon any non-standard jar files in Tomcat's lib, you'll need those too.)

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16616

J2EE is defined in terms of WARs, not "folders". A J2EE webapp is according to the spec, a WAR or EAR (except Tomcat doesn't handle EARs), which is a JAR (ZIP) archive with a particular structure plus certain controlling "files" within that structure.

Tomcat is one of many webapp servers that supports the notion of an "exploded" WAR, which is simply WAR which has been unZIPped. So the easiest/safest way to transport a webapp to another Tomcat is like this:

1. "cd" to the TOMCAT_HOME/webapps directory. Or wherever the webapps have been deployed, but I'm assuming the default.

2. If there is both a "xxxx" and an "xxxx.war" file in that directory, delete "xxxx.war". Tomcat always uses the exploded WAR if it sees both plain and exploded webapps in its directory, so the existing war isn't what's actually being used.

3. create a (new) WAR from the exploded WAR, like so:

This should JAR (ZIP) up the WAR into a warfile.

4. Transfer the WAR file to the new Tomcat's webapps directory.

5. If you had an external deployment descriptor for the webapp (generally a Context in the TOMCAT_HOME/conf/Catalina/localhost directory), also copy that to the new Tomcat's conf/Catalina/localhost. Change any options which need changing. For example, you might want the copy to talk to a different database.

That's all there is. At least unless your webapp was so crude as to have written data files into the WAR. Which it shouldn't.

Customer surveys are for companies who didn't pay proper attention to begin with.
I agree. Here's the link:
subject: Copying project from webapp folder to other tomcat server