简体   繁体   English

为什么我不能将此ROOT.war文件部署到远程Tomcat服务器中? 当我重新启动Tomcat时,它将创建一个“空”的ROOT目录

[英]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.

相关问题 Tomcat不会扩展ROOT.war,但会扩展所有其他战争 - Tomcat not expanding ROOT.war but expand all other wars 为什么我无法在 Tomcat 上部署? 无法在本地主机上发布 Tomcat v7.0 服务器的服务器配置。 多个上下文的路径为“/ROOT”? - Why I can't deploy on Tomcat? Could not publish server configuration for Tomcat v7.0 Server at localhost. Multiple Contexts have a path of "/ROOT"? 我可以有多个文件夹(如webapps)并指定要访问哪个ROOT.war文件的域 - Can I have multiple folders like webapps and specify what domains to access which ROOT.war file Openshift上的ROOT.war文件 - ROOT.war file on Openshift Tomcat使用war文件作为url部署到远程服务器 - Tomcat deploy to remote server with war file as url Tomcat-将War部署到远程tomcat时出现NoClassDefFoundError - Tomcat - NoClassDefFoundError when deploy war to remote tomcat tomcat 生成空ROOT文件夹但不解压war文件 - tomcat generate empty ROOT folder but does not unpack the war file 通过战争在Tomcat上部署源,更改html时必须重新启动服务器吗? - Deploy the source by war at Tomcat, must restart the server when change the html? Tomcat 8,在同一根目录下发布2 .war - Tomcat 8, publish 2 .war under same root directory 如何在Tomcat 6中部署war - How can I deploy war in Tomcat 6
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM