Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying a WAR in Tomcat / Eclipse

I use Tomcat 6.0 and Eclipse 3.0 under Linux and I try to deploy a WAR in Tomcat. The problem is that the server is managed by Eclipse and I have some Eclipse project deployed. I tried to modify the server.xml file then launch Tomcat via Eclipse but it doesn't work:

Could not load the Tomcat server configuration at /Servers/Tomcat v6.0 Server at localhost-config. The configuration may be corrupt or incomplete.

I tried to extract the war in the webapps directory but the webapp is still inaccessible.

What is the best practice to deploy a War ?

like image 494
Loïc Guillois Avatar asked Nov 24 '10 16:11

Loïc Guillois


People also ask

How can I deploy WAR file in Tomcat?

Perhaps the simplest way to deploy a WAR file to Tomcat is to copy the file to Tomcat's webapps directory. Copy and paste WAR files into Tomcat's webapps directory to deploy them. Tomcat monitors this webapps directory for changes, and if it finds a new file there, it will attempt to deploy it.

What happens when we deploy a WAR file in Tomcat?

Java web applications are usually packaged as WAR files for deployment. These files can be created on the command line or with an IDE, like Eclipse. After deploying the WAR file, Tomcat unpacks it and stores all the project files from the webapps directory in a new directory named after the project.


1 Answers

If all you have is a binary WAR (no source code), it cannot be installed within Eclipse. This can happen in certain scenarios outside of normal development workflows. Here's the work-around solution:

  1. Launch another instance of Tomcat (outside Eclipse).
  2. Modify the tomcat-users.xml file to enable admin
  3. Go to http://localhost:8080/manager/html
  4. Scroll down to WAR file to deploy
  5. Click Choose File (next to Select WAR file to upload) and click Deploy.
like image 66
Alex R Avatar answered Nov 16 '22 01:11

Alex R