【问题标题】:The maven web project runs error in eclipse(tomcat 7):error:Cannot invoke Tomcat manager: Software caused connection abort: socket write errormaven web项目在eclipse(tomcat 7)中运行错误:错误:无法调用Tomcat管理器:软件导致连接中止:套接字写入错误
【发布时间】:2017-07-15 07:37:57
【问题描述】:

我使用tomcat7、eclipse 4.6.2和我自己的maven 3(不是eclipse默认的)。

这是我的 tomcat_users.xml:

  <role rolename="tomcat"/>
  <role rolename="manager"/>
  <role rolename="manager-gui"/>
  <role rolename="manager-script" />
  <role rolename="admin-gui"/>
  <user username="tomcat" password="tomcat" roles="tomcat,manager,manager-script,admin-gui" />
  <user username="admin" password="admin" roles="manager-gui" />

这是我在 maven 3 中的 settings.xml:

E:\apache-maven-3.3.9\conf\settings.xml

<server> 
       <id>tomcat7</id> 
       <username>admin</username> 
       <password>admin</password> 
</server>

本地仓库在 C:\Users\zhuxiaodong.m2\repository

我创建了一个名为“webapp”的 maven web 项目 我的 pom.xml 部分是:

<build>  
       <finalName>webapp</finalName>  
       <plugins>  
            <!-- Eclipse project -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <!-- Always download and attach dependencies source code -->
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>false</downloadJavadocs>
                    <!-- Avoid type mvn eclipse:eclipse -Dwtpversion=2.0 -->
                    <wtpversion>2.0</wtpversion>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.tomcat.maven</groupId>
                <artifactId>tomcat7-maven-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <url>http://localhost:8425/manager/text</url>
                    <username>admin</username>
                    <password>admin</password>
                    <server>tomcat7</server>
                    <path>/${project.build.finalName}</path>
                </configuration>
            </plugin> 
       </plugins>  
   </build>
   <repositories>
        <repository> 
            <id>people.apache.snapshots</id> 
            <url> 
                http://repository.apache.org/content/groups/snapshots-group/ 
            </url> 
            <releases> 
                <enabled>false</enabled> 
            </releases> 
            <snapshots> 
                <enabled>true</enabled> 
            </snapshots> 
        </repository> 
    </repositories>

    <pluginRepositories>
        <pluginRepository> 
            <id>apache.snapshots</id> 
            <name>Apache Snapshots</name> 
            <url> 
                http://repository.apache.org/content/groups/snapshots-group/ 
            </url> 
            <releases> 
                <enabled>false</enabled> 
            </releases> 
            <snapshots> 
                <enabled>true</enabled> 
            </snapshots> 
        </pluginRepository>
    </pluginRepositories>

enter image description here 我运行这个项目:

[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:deploy (default-cli) on project webapp: Cannot invoke Tomcat manager: Software caused connection abort: socket write error -> [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/MojoExecutionException

怎么了?谢谢! 如果信息不完整,我会显示更多细节。 (该项目用于测试spring mvc和spring security)

【问题讨论】:

    标签: java eclipse maven tomcat jakarta-ee


    【解决方案1】:

    您可以尝试在Tomcat的server.xml中使用下面的块

    <Connector port="8080" protocol="HTTP/1.1"
               connectionTimeout="20000"
               redirectPort="8443" />
    

    并将端口更改为8080,而不是pom.xml 中的8425

    【讨论】:

    • 问题出在 tomcat_users.xml 中。 l 将 manager-jmx 配置添加到 admin。我成功了
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-02-21
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    • 2019-07-27
    • 2011-01-08
    相关资源
    最近更新 更多