简体   繁体   English

配置tomcat并托管Java Web应用程序

[英]Configuring tomcat and hosting a java web application

I have copied the war file of my java web application (Inside system A containing the hosting server) in the webapps folder of tomcat 7. What are the steps to access this application from "System B" given that I know ip address of the "A". 我已将我的Java Web应用程序(包含主机服务器的内部系统A)的war文件复制到tomcat 7的webapps文件夹中。鉴于“我知道”的IP地址,从“系统B”访问该应用程序的步骤是什么?一种”。 What are the steps to complete the hosting procedure and make sure my tomcat is properly configured. 完成托管过程并确保正确配置了我的tomcat的步骤是什么?

Add the name of the webapplication in the url which is usually the name of the war file (without the .war extension). 在url中添加Web应用程序的名称,该名称通常是war文件的名称(不带.war扩展名)。

http://<ip-comes-here>:<port>/<webappname>

Eg if your .war file is named myapp.war , then you can access it at: 例如,如果您的.war文件名为myapp.war ,则可以在以下位置访问它:

http://<ip-comes-here>:<port>/myapp

This can be overridden and there is a special ROOT webapp name (might come from ROOT.war ) which will be available at the root of your host: 可以覆盖此名称,并且有一个特殊的ROOT ROOT.war应用程序名称(可能来自ROOT.war ),该名称在主机的根目录中可用:

http://<ip>:<port>/

Installing TOMCAT & Configuring: 安装TOMCAT和配置:

Install the tomcat from here :select the required version from download. 此处安装tomcat:从下载中选择所需的版本。

Setting the environment variable: 设置环境变量:

System Properties->Advanced->Environment Variables 系统属性->高级->环境变量

Variable Name : CATALINA_HOME 变量名称:CATALINA_HOME
Variable Value: C:\\TOMCAT 7.0.10 (your tomcat directory) 变量值:C:\\ TOMCAT 7.0.10(您的tomcat目录)

Check your port number in Tomcat--->conf--->server.xml 在Tomcat ---> conf ---> server.xml中检查您的端口号

<Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" 
redirectPort="8443" />

Please note that your oracle is having a default port number 8080. Make sure no conflicts are there 请注意,您的oracle具有默认端口号8080。请确保没有冲突。

Start the server(Go to the bin folder of tomcat and use startup.bat in windows and startup.sh for linux) 启动服务器(转到tomcat的bin文件夹,在Windows中使用startup.bat,在Linux中使用startup.sh)

Then try the url in any web browser : 然后在任何网络浏览器中尝试该网址:

 http://localhost:portNumber/

If you get the tomcat homepage your tomcat is properly configured. 如果您获得了tomcat主页,则说明您的tomcat已正确配置。

Deploying application war File : 部署应用程序war文件:

Step 1:stop tomcat(Go to the bin folder of tomcat and use shutdown.bat in windows and shutdown.sh for linux)
Step 2:move your war into "[tomcat install dir]/webapps"
Step 3:start tomcat

Then try to access your web application as explained in the first answer in any web browser 然后尝试在任何Web浏览器中按照第一个答案中的说明访问Web应用程序

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM