如何解决Maven连接异常错误

时间:2013-12-13 09:31:30

标签: eclipse maven tomcat

有人可以帮我解决这个问题......我花了太多时间处理这个错误,但无法解决这个问题......

[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.1:
deploy (default-cli) on project HelloMaven: Cannot invoke Tomcat manager: Connection to http:// localhost:8080 refused: Connection refused: connect -> [Help 1]

[ERROR]

[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.

[ERROR] Re-run Maven using the -X switch to enable full debug logging.

[ERROR]

[ERROR] For more information about the errors and possible solutions, please read the following articles:

[ERROR] [Help 1] http:// cwiki.apache.org/confluence/display/MAVEN/ConnectException

以下是我的pom.xml:

<modelVersion>4.0.0</modelVersion>
<groupId>com.abc.app</groupId>
<artifactId>HelloMaven</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>HelloMaven Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>
<build>
    <finalName>HelloMaven</finalName>
    <plugins>
        <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.0</version>
            <configuration>
                <url>http://localhost:8080/manager/html</url>
                <server>TomcatServer</server>
                <path>/HelloMaven</path>
            </configuration>
        </plugin>

        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
            </configuration>
        </plugin>
    </plugins>
</build>

1 个答案:

答案 0 :(得分:0)

  1. 首先说明您正在运行的Tomcat版本。这一点非常重要,因为配置略有不同。我将为Tomcat 7描述它。
  2. 在tomcat-user.xml中定义新用户并为其分配权限“manager-script”。该用户应该没有其他经理-...-角色。
  3. 打开pom.xml并更改tomcat7-plugin的配置。将URL更改为http:// localhost:8080 / manager / text。请记住,您使用的是文本控制台,而不是html-console。
  4. 转到您的settings.xml并检查是否存在具有您在tomcat7-plugin-configuration中使用的相应ID的服务器配置。 例如:
  5. <server>
        <id>TomcatServer</id>
        <username>scriptuser</username>
        <password>mypassword</password>
    </server>
    
相关问题