一千萬個為什麽

搜索

Tomcat-maven-plugin 401錯誤

我正在學習tomcat基礎知識,當我嘗試在tomcat上部署我的web應用程序時,我收到以下錯誤

[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project struts2-demoapp: Cannot invoke Tomcat manager: Server returned HTTP response code: 401 for URL: http://localhost:8080/manager/html/deploy?path=%2FmkyWebApp&war= -> [Help 1]
[ERROR]

as per this it seems war file location is not being passed to the tomcat manager.i have the following entries in my tomcat-user.xml

tomcat-users>
<!--
  NOTE:  The sample user and role entries below are wrapped in a comment
  and thus are ignored when reading this file. Do not forget to remove
   that surrounds them.
-->


  
  



here are the details of the pom.xml


        
        
                maven-war-plugin
                2.1.1
                
                    WEB-INF/web.xml
                
            
            
        org.codehaus.mojo
        tomcat-maven-plugin
        
                ${project.build.directory}/${project.build.finalName}.war
                http://localhost:8080/manager/html
                myserver
                /mkyWebApp

        


        
    

在我的setting.xml中有條目


      <id>Tomcat6.x<\/id>

      <username>admin<\/username>
      <password>admin<\/password>
    

我不確定這裏到底出了什麽問題。在這方面的任何幫助都會有所幫助。

最佳答案

更改


  <id>Tomcat6.x<\/id>
  <username>admin<\/username>
  <password>admin<\/password>


  <id>myserver<\/id>
  <username>admin<\/username>
  <password>admin<\/password>

如果你使用的是tomcat 7

 http://localhost:8080/manager/html

如果是tomcat 6

http://localhost:8080/manager

啟動tomcat運行tomcat7:deploy或tomcat6:deploy

轉載註明原文: Tomcat-maven-plugin 401錯誤