gpt4 book ai didi

eclipse - Maven连接异常错误如何解决

转载 作者:行者123 更新时间:2023-11-28 23:40:04 24 4
gpt4 key购买 nike

谁能帮我解决这个问题……我花了太多时间解决这个错误,但无法解决这个问题……

[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. 首先明确您运行的是哪个版本的 Tomcat。它本质上很重要,因为配置略有不同。我将为 Tomcat 7 描述它。
  2. 在您的 tomcat-user.xml 中定义一个新用户并为其分配权限“manager-script”。此用户不应有其他经理-...-角色。
  3. 打开您的 pom.xml 并更改您的 tomcat7 插件的配置。将 url 更改为 http://localhost:8080/manager/text。请记住,您使用的是文本控制台而不是 html 控制台。
  4. 转到您的 settings.xml 并检查是否有一个服务器配置具有您在 tomcat7-plugin-configuration 中使用的相应 id。例如:
<server>
<id>TomcatServer</id>
<username>scriptuser</username>
<password>mypassword</password>
</server>

关于eclipse - Maven连接异常错误如何解决,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20563083/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com