2012-07-06 95 views
1

我嘗試在Tomcat 7部署新的Maven項目,我得到行家2.2.1的Tomcat 7無法調用Tomcat管理:401

[INFO] Building war: C:\Workspace2\sw\webapp\target\mkyongweb-core-1.0.war 
[INFO] [tomcat:deploy {execution: default-cli}] 
[INFO] Deploying war to http://localhost:8080/mkyongweb-core 
[INFO] ------------------------------------------------------------------------ 
[ERROR] BUILD ERROR 
[INFO] ------------------------------------------------------------------------ 
[INFO] Cannot invoke Tomcat manager 

Embedded error: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/deploy?path=%2Fmkyongweb-core&war= 

的tomcat-users.xml中

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

%MAVEN入戶%/ conf目錄/ settings.xml的

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

和我的pom.xml(tomcat6中)

<build> 
     <plugins> 
      <!-- Maven Tomcat Plugin --> 
      <plugin> 
      <groupId>org.codehaus.mojo</groupId> 
      <artifactId>tomcat-maven-plugin</artifactId> 
      <version>1.0</version> 
      <configuration> 
      <server>tomcat7</server> 
      <url>h ttp://loca lhost:8080/manager</url>     
      <path>/mkyongWebApp</path> 
      </configuration> 
     </plugin>   
      <!-- Maven compiler plugin --> 
      <plugin> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 

     </plugins> 
    </build> 

這pom.xml的讓錯誤401

[INFO] Cannot invoke Tomcat manager Embedded error: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/deploy?path=%2Fmkyongweb-core&war=

和下面的插件讓同樣的錯誤

<plugins> 
     <!-- Maven Tomcat Plugin --> 
     <plugin>    
     <groupId>org.apache.tomcat.maven</groupId> 
     <artifactId>tomcat6-maven-plugin</artifactId> 
     <version>2.0-beta-1</version> 
     <configuration>    
      <server>tomcat7</server> 
      <url>http://localhost:8080/manager</url> 
      <path>/mkyongWebApp</path> 
     </configuration> 
    </plugin>   

     <!-- Maven compiler plugin --> 
     <plugin> 
      <artifactId>maven-compiler-plugin</artifactId> 
      <configuration> 
       <source>1.6</source> 
       <target>1.6</target> 
      </configuration> 
     </plugin> 

    </plugins> 

回答

0

你必須給全球化志願服務青年到服務器(tomcat7)

 <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>tomcat-maven-plugin</artifactId> 
     <configuration> 
      <server>tomcat7</server> 
      <url>http://localhost:8080/manager/html</url> 
     </configuration> 
     </plugin>   
+0

我聽說有與codehause插件tomcat7一個問題,所以我將其更改爲6,但我仍然有同樣的問題。 – user1506541 2012-07-09 08:39:48