【问题标题】:Failing to deploy webapp in tomcat using maven cargo无法使用 maven cargo 在 tomcat 中部署 webapp
【发布时间】:2011-04-19 09:45:43
【问题描述】:

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

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

[INFO] 部署失败 [C:\Users\Ramesh\workspace\SimpleSpringMvcExample\target \SimpleSpringMvcExample.war] 失败 - 遇到异常 java.io.FileNotFoundException: C:\Program Files\Apa che 软件 基金会\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 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>

我想我在pom.xml 中给出了正确的tomcat 管理员ID 和密码,但不知道哪里错了?

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

不知道跟这个有没有关系……

请帮我定位问题..

提前致谢。

【问题讨论】:

    标签: web-applications maven-2 tomcat maven-cargo


    【解决方案1】:

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

    您是否使用已打开 UAC 的 Vista/Windows 7?

    【讨论】:

    • 我在谷歌上搜索了 UAC 并关闭了它,现在它工作正常..谢谢哥们。
    猜你喜欢
    • 2011-09-20
    • 2015-04-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-02
    • 2013-06-05
    • 1970-01-01
    • 2023-03-14
    相关资源
    最近更新 更多