Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to deploy Java web application project from Eclipse to live Tomcat server?

Tags:

I have developed an web application using HTML, Java Servlet and all. While developing I was using Tomcat to deploy it in order to test it.

Now my development is done and I want to make it live. For that we have live server but as I am new to all this I dont know how to deploy my java web application on live server?

So please help me if you know to answer?

My Project Structure

     ProjectName          ->src                ->beanClass                        ->class1                        ->Class2                ->easyServlet                            ->Servlet1                        ->Servlet2                        ->Servlet3                ->easyTrans                        ->Class1                            ->Class2                            ->Class3                            ->Class4              ->build          ->WebContent                ->META-INF                        ->MENIFEST.mf                ->WEB-INF                        ->lib(contain javascript files)                        ->web.xml                ->html1                ->html2                ->html3                ->html4                ->html5 

I am also using MySql so what I have to about it..

like image 862
mahesh Avatar asked Jul 01 '11 09:07

mahesh


People also ask

How do I deploy a web application using apache tomcat Manager?

To deploy a web application to Apache Tomcat, you can copy a WAR file to the application base directory, e.g., c:/Tomcat8/webapps . This operation of course presupposes we know the application base directory. We could consult server. xml and look up the Host element to determine the directory name.


1 Answers

  1. You will have to build a WAR of the project. You can do this

    • in eclipse: right click on the project, Click "Export", and choose war file in the dialog (and mention, the destination, name and all)
    • via ant using the war task

      The ant option is better because when you have multiple developers on the project and the code is in version control, it is easier to get the project automatically (using ant) and build a war. (you have version control, don't you?)

    But this is more of an operational difference (albeit an important one) but the war created in either way are same

  2. Deploy the war to the server

    • You can manually copy the war file to the $TOMCAT_HOME/webapps directory (See the "Creating and Deploying a WAR File" section on this article)

    • You can use the Tomcat 6 "Manager" application.

Update
You said that you are using MySql also. MySql should be installed on a server (it can be on the same server) and the configuration should be changed (username, password, server details) so that the application connects to the same database (I am sure you are not hard coding database details and credentials in your application and reading them from some configuration, this is the configuration that has to be changed)

like image 171
Nivas Avatar answered Sep 28 '22 22:09

Nivas