如何将 Java Web 应用程序项目从 Eclipse 部署到实时 Tomcat 服务器? [英] How to deploy Java web application project from Eclipse to live Tomcat server?

查看:21
本文介绍了如何将 Java Web 应用程序项目从 Eclipse 部署到实时 Tomcat 服务器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 HTML、Java Servlet 等开发了一个 Web 应用程序.在开发过程中,我使用 Tomcat 进行部署,以便对其进行测试.

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.

现在我的开发已经完成,我想让它上线.为此,我们有实时服务器,但由于我是这一切的新手,我不知道如何在实时服务器上部署我的 Java Web 应用程序?

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?

我的项目结构

     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

我也在使用 MySql,所以我必须做些什么..

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

推荐答案

  1. 您必须构建项目的 WAR.你可以这样做

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

  • 在eclipse中:右键单击项目,单击导出",然后在对话框中选择war文件(并提及,目的地,名称等)
  • 通过 ant 使用 war 任务

ant 选项更好,因为当项目有多个开发人员并且代码处于版本控制中时,更容易自动获取项目(使用 ant)并构建战争.(你有版本控制,不是吗?)

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

将战争部署到服务器

  • 您可以手动将 WAR 文件复制到 $TOMCAT_HOME/webapps 目录(请参阅 这篇文章)

您可以使用 Tomcat 6 管理器"应用程序.

You can use the Tomcat 6 "Manager" application.

更新
你说你也在使用MySql.MySql 应该安装在服务器上(它可以在同一台服务器上)并且应该更改配置(用户名、密码、服务器详细信息),以便应用程序连接到同一个数据库(我确定您不是在应用程序中硬编码数据库详细信息和凭据并从某些配置中读取它们,这是必须更改的配置)

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)

这篇关于如何将 Java Web 应用程序项目从 Eclipse 部署到实时 Tomcat 服务器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆