• 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

Copying project from webapp folder to other tomcat server

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?


Thanks.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.)
 
Saloon Keeper
Posts: 27762
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Let's get him boys! We'll make him read this tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic