2017-02-24 126 views
0

我使用tomcat7,eclipse 4.6.2和我自己的maven 3(不是默認的eclipse )。maven web項目在eclipse(tomcat 7)中運行錯誤:錯誤:無法調用Tomcat管理器:軟件導致連接中止:套接字寫入錯誤

這裏是我的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的行家-3.3.9 \的conf \ settings.xml的

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

本地資源庫是在C:\用戶\ zhuxiaodong.m2 \庫

我創建一個名爲maven的web項目「W ebapp」 和我的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和春季安全)

回答

0

您可以嘗試在Tomcat的server.xml

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

使用下面的博克和端口改爲8080而不是8425pom.xml

+0

謝謝!我已經解決了這個問題。 –

+0

問題出在tomcat_users.xml中。 l將manager-jmx配置添加到管理員。和l成功 –

相關問題