[英]Why I can't deploy this ROOT.war file into my remote Tomcat server? When I restart Tomcat it creates an “empty” ROOT directory
I have the following problem. 我有以下问题。
I am working on a Java web application and I am experiencing the following problem trying to deploy it on a remote Tomcat server (on a remote Linux machine). 我正在使用Java Web应用程序,并且在将其部署到远程Tomcat服务器(位于远程Linux机器上)时遇到以下问题。
So I take my ROOT.war file generated by maven compilation and I put into the webapp directory in my remote Tomcat server, this one: /usr/local/tomcat/myproject/webapps 因此,我将maven编译生成的ROOT.war文件放入远程Tomcat服务器的webapp目录中,该目录为: / usr / local / tomcat / myproject / webapps
where myproject should be a specific Tomcat instance because it contains: 其中myproject应该是特定的Tomcat实例,因为它包含:
[myuser@myserver myproject]$ ls
conf lib logs server shared temp webapps work
So I do the following steps: 因此,我执行以下步骤:
1) I stop Tomcat. 1)我停止了Tomcat。
2) I enter into the webapps directory and here I remove the ROOT subdirectory. 2)我进入webapps目录,然后在这里删除ROOT子目录。
3) I put my ROOT.war file into /usr/local/tomcat/myproject/webapps/ROOT/ directory. 3)我将ROOT.war文件放入/ usr / local / tomcat / myproject / webapps / ROOT /目录。
4) I start Tomcat. 4)我启动Tomcat。
Now I expect that at start time Tomcat unpack the ROOT.war file into a new ROOT directory so my application should be deployed. 现在,我希望Tomcat在启动时将ROOT.war文件解压缩到新的ROOT目录中,以便部署我的应用程序。
The problem is that after the Tomcat restart I have the new /usr/local/tomcat/myproject/webapps/ROOT/ directory but it doesn't contain my deployed application. 问题是在Tomcat重新启动后,我有了新的/ usr / local / tomcat / myproject / webapps / ROOT /目录,但其中不包含我已部署的应用程序。 This folder is almost empty, infact it contains only: 此文件夹几乎为空,实际上它仅包含:
[myuser@myserver ROOT]$ ls -R
.:
WEB-INF
./WEB-INF:
classes
./WEB-INF/classes:
reports
./WEB-INF/classes/reports:
As you can see it only contains the WEB-INF directory withs some basic subfolder. 如您所见,它仅包含带有一些基本子文件夹的WEB-INF目录。
Why? 为什么? What am I missing? 我想念什么? Can I manually unpack my ROOT.war file in some way or is it not a good solution? 我可以通过某种方式手动解压缩ROOT.war文件,还是不是一个好的解决方案? How can I fix this issue? 如何解决此问题?
Are you using Maven to build projects?If you use Maven to build a project, you can use the following configuration 您正在使用Maven来构建项目吗?如果您使用Maven来构建项目,则可以使用以下配置
<build>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<port>8080</port>
<path>/</path>
<url>http://192.168.25.135:8080/manager/text</url>
<username>tomcat</username>
<password>tomcat</password>
</configuration>
</plugin>
</plugins>
</build>
Configuration file in Tomcat: Tomcat中的配置文件:
<tomcat-users>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<role rolename="manager-status"/>
<user username="tomcat" password="tomcat" roles="manager-gui,manager-script,manager-jmx,manager-status,admin-script,admin-gui"/>
</tomcat-users>
Use the Maven command: 使用Maven命令:
mvn tomcat7:redeploy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.