maven 2.2.1 Tomcat 7 ไม่สามารถเรียกใช้ Tomcat manager:401

ฉันพยายามปรับใช้โปรเจ็กต์ maven ใหม่บน Tomcat 7 และฉันก็เข้าใจ

[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-HOME%/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

[ข้อมูล] ไม่สามารถเรียกใช้ข้อผิดพลาดที่ฝังตัวจัดการ Tomcat: เซิร์ฟเวอร์ส่งคืนรหัสตอบกลับ HTTP: 401 สำหรับ 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>

person user1506541    schedule 06.07.2012    source แหล่งที่มา


คำตอบ (2)


คุณควรใช้ปลั๊กอิน apache maven tomcat แทน codehaus tomcat-maven-plugin

http://tomcat.apache.org/maven-plugin-2/

ตามที่กล่าวไว้บนเว็บไซต์ใน codehaus

person khmarbaise    schedule 06.07.2012

คุณต้องให้การอ้างอิงถึงเซิร์ฟเวอร์ (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>          
person Mustafa SAHIN AYDIN    schedule 08.07.2012
comment
ฉันได้ยินมาว่ามีปัญหากับปลั๊กอิน codehause สำหรับ tomcat7 ดังนั้นฉันจึงเปลี่ยนเป็น 6 แต่ฉันยังคงประสบปัญหาเดิมอยู่ - person user1506541; 09.07.2012