我已经复印了样品。在Tomcat的webapps目录下,我可以访问localhost:8080。

Tomcat如何部署,需要在浏览器中打开吗?如何访问该应用程序?


当前回答

In addition to the ways already mentioned (dropping the war-file directly into the webapps-directory), if you have the Tomcat Manager -application installed, you can deploy war-files via browser too. To get to the manager, browse to the root of the server (in your case, localhost:8080), select "Tomcat Manager" (at this point, you need to know username and password for a Tomcat-user with "manager"-role, the users are defined in tomcat-users.xml in the conf-directory of the tomcat-installation). From the opening page, scroll downwards until you see the "Deploy"-part of the page, where you can click "browse" to select a WAR file to deploy from your local machine. After you've selected the file, click deploy. After a while the manager should inform you that the application has been deployed (and if everything went well, started).

以下是来自Tomcat 7文档页面的更长的操作说明和其他说明。

其他回答

你只需要把war文件放在webapps中,然后启动你的服务器。

它将被部署。

否则,你也可以使用tomcat管理器在webfront上远程上传和部署你的战争。

您可以从http://localhost:8080/sample访问您的应用程序

war文件的部署或重新部署在默认情况下是自动的——在复制/覆盖文件示例之后。War,检查你的webapps文件夹中提取的文件夹示例。

如果不能正常打开,请检查日志文件(例如tomcat/logs/catalina.out),查看是否存在部署问题。

如果你在linux中使用apt-get安装了tomcat7,那么将你的应用部署到/var/lib/tomcat7/webapps/

eg.

sudo service tomcat7 stop

mvn clean package
sudo cp target/DestroyTheWorldWithPeace.war /var/lib/tomcat7/webapps/
#you might also want to make sure war file has permission (`777` not just `+x`)
sudo service tomcat7 start

另外,继续跟踪tomcat日志,以便您可以验证应用程序实际上正在与tomcat和平共处。

tail -f /var/lib/tomcat7/logs/catalina.out

部署的应用程序应该出现在http://172.16.35.155:8080/manager/html中

步骤1。首先到tomcat webapps文件夹并粘贴它

步骤2。进入tomcat->bin文件夹,单击startup.bat启动tomcat

步骤3。去浏览器写localhost:端口/项目名等。Localhost:8080/pos(这里我的tomcat运行在端口8080上)

做……

手动步骤- Windows

复制.war文件(例如:prj.war)到%CATALINA_HOME%\webapps(例如:C:\tomcat\webapps) 运行% CATALINA_HOME % \ bin \ startup.bat 您的.war文件将自动提取到具有相同名称(没有扩展名)的文件夹(例如:prj) 转到%CATALINA_HOME%\conf\server.xml,并获取HTTP协议的端口。<连接器端口="8080"…/ >。缺省值为8080。 访问以下网址: (<协议>:/ / localhost: <端口> /文件夹/ resourceName (例如:localhost: 8080 /文件夹/ resourceName)

不要尝试访问没有资源名的URL,因为如果没有像index.html这样的文件,或者如果在web.xml中没有像“/”或“/*”这样的URL模式,它将不起作用。

可用的主路径在这里:[<protocol>://]localhost:<port>/manager/html(例如:http://localhost:8080/manager/html),它们在“Running”列上有true。


使用UI管理器:

Go to [<protocol>://]localhost:<port>/manager/html/ (usually localhost:8080/manager/html/) This is also achievable from [<protocol>://]localhost:<port> > Manager App) If you get: 403 Access Denied go to %CATALINA_HOME%\conf\tomcat-users.xml and check that you have enabled a line like this: <user username="tomcat" password="tomcat" roles="tomcat,role1,manager-gui"/> In the Deploy section, WAR file to deploy subsection, click on Browse.... Select the .war file (E.g.: prj.war) > click on Deploy. In the Applications section, you can see the name of your project (E.g.: prj).