使用 Maven Cargo 在 Tomcat 中部署 Web 应用程序失败

发布于 2024-09-26 05:21:03 字数 4653 浏览 5 评论 0原文

我正在尝试使用 maven cargo 插件将 Web 应用程序部署到 tomcat 服务器中。

但是当我在命令提示符中运行命令 mvn Cargo:deploy 时,出现以下错误。

[信息] 部署失败 [C:\Users\Ramesh\workspace\SimpleSpringMvcExample\target \SimpleSpringMvcExample.war] 失败 - 遇到异常 java.io.FileNotFoundException: C:\Program Files\Apa che Software 基金会\Tomcat 6.0\webapps\SimpleSpringMvcExample.war(访问被拒绝)

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.SimpleSpringMvcExample</groupId>
    <artifactId>SimpleSpringMvcExample</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>SimpleSpringMvcExample Maven Webapp</name>
    <url>http://maven.apache.org</url>

    .....

    <build>
        <finalName>SimpleSpringMvcExample</finalName>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>

                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>admin</cargo.remote.username>
                            <cargo.remote.password>admin</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>com.SimpleSpringMvcExample</groupId>
                                <artifactId>SimpleSpringMvcExample</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.0-beta-1</version>
            </plugin>
        </plugins>
    </build>
</project>

tomcat-users.xml

<?xml version='1.0' encoding='cp1252'?>

<tomcat-users>
<user name="admin" password="admin" roles="admin,manager" />
</tomcat-users>

maven < strong>settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  <mirrors>
  </mirrors>
  <profiles>
  </profiles>
</settings>

我想我给出了正确的 id & tomcat admin 的密码在 pom.xml 中,但不知道出了什么问题?

它工作正常..但突然开始抛出此错误...在我将 maven-tomcat-plugin 用于示例 spring 项目之一后..

我不知道如果它与此有关...

请帮助我找到问题...

提前致谢。

I am trying to deploy a webapplication using maven cargo plugin into tomcat server.

But i am getting the below error when i am running the command mvn cargo:deploy in the command prompt.

[INFO] Failed to deploy
[C:\Users\Ramesh\workspace\SimpleSpringMvcExample\target
\SimpleSpringMvcExample.war] FAIL -
Encountered exception
java.io.FileNotFoundException:
C:\Program Files\Apa che Software
Foundation\Tomcat
6.0\webapps\SimpleSpringMvcExample.war (Access is denied)

pom.xml

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.SimpleSpringMvcExample</groupId>
    <artifactId>SimpleSpringMvcExample</artifactId>
    <packaging>war</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>SimpleSpringMvcExample Maven Webapp</name>
    <url>http://maven.apache.org</url>

    .....

    <build>
        <finalName>SimpleSpringMvcExample</finalName>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.0.2</version>
                <configuration>
                    <source>1.5</source>
                    <target>1.5</target>
                </configuration>
            </plugin>
            <plugin>

                <groupId>org.codehaus.cargo</groupId>
                <artifactId>cargo-maven2-plugin</artifactId>
                <version>1.0</version>
                <configuration>
                    <container>
                        <containerId>tomcat6x</containerId>
                        <type>remote</type>
                    </container>
                    <configuration>
                        <type>runtime</type>
                        <properties>
                            <cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>
                            <cargo.remote.username>admin</cargo.remote.username>
                            <cargo.remote.password>admin</cargo.remote.password>
                        </properties>
                    </configuration>
                    <deployer>
                        <type>remote</type>
                        <deployables>
                            <deployable>
                                <groupId>com.SimpleSpringMvcExample</groupId>
                                <artifactId>SimpleSpringMvcExample</artifactId>
                                <type>war</type>
                            </deployable>
                        </deployables>
                    </deployer>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>tomcat-maven-plugin</artifactId>
                <version>1.0-beta-1</version>
            </plugin>
        </plugins>
    </build>
</project>

tomcat-users.xml

<?xml version='1.0' encoding='cp1252'?>

<tomcat-users>
<user name="admin" password="admin" roles="admin,manager" />
</tomcat-users>

maven settings.xml

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
  <pluginGroups>
  </pluginGroups>
  <proxies>
  </proxies>
  <servers>
  </servers>
  <mirrors>
  </mirrors>
  <profiles>
  </profiles>
</settings>

I think i gave the correct id & password of tomcat admin in the pom.xml But dont know whats wrong?

It was working fine..but suddenly started throwing this error...after i used the maven-tomcat-plugin for one of the sample spring projects..

I dont know if it has anything to do with this...

Please help me in locating the problem..

Thanks in Advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短叹 2024-10-03 05:21:03

从错误看来,权限存在问题 - maven 似乎没有权限将 .war 文件放入 tomcat 的 webapps 文件夹中。

您是否在 Vista/Windows 7 上开启了 UAC?

From the error it appears that there is an issue with permissions - maven does not seem to have permission placing the .war file in tomcat's webapps folder.

Are you on Vista/Windows 7 with UAC turned On?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文