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

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


当前回答

如果你在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中

其他回答

请执行以下步骤:

停止Tomcat 右键点击项目,点击“清洁和构建” 转到你的项目目录和Dist文件夹内,你会得到你复制到tomcat上的war文件 webApp目录 启动tomcat 自动战争文件提取和运行您的项目

为了在tomcat上部署war文件, 请遵循以下步骤:

停止tomcat。powershell - >服务。msc->OK->Apache Tomcat 8.5->stop(在左侧)。

把。war文件放在E:\Tomcat_Installation\webapps文件夹中,也就是Put。战争(。战争只是一个例子)

启动tomcat后(启动tomcat powershell->服务)。msc - >确定- > Apache Tomcat 8.5 - >开始)

你会在E:\Tomcat_Installation\webapps**put**中得到一个文件夹

通过这种方式,您可以在Apache Tomcat中部署war文件。

这对我来说很管用:

在本地创建war文件(mysite.war)。 在本地将它重命名为。war以外的东西,比如mysite.www 在tomcat仍然运行的情况下,上传mysite。WWW到webapps目录。 上传完成后,删除之前版本的mysite.war 列出目录,等待目录/mysite消失。 重命名mysite。WWW是神秘的。战争 列出目录,等待新的/mysite被创建。

如果在tomcat仍在运行的情况下,尝试将新文件作为war文件上传,它将尝试在所有文件就绪之前对其进行扩展。它会失败。既然失败了,它就不会再尝试了。因此,上传一个www文件,然后重命名它,允许在tomcat注意到它之前呈现整个war文件。

提示,不要忘记检查war文件的所有者是tomcat(使用chown)

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文档页面的更长的操作说明和其他说明。

如果你在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中