2014-04-22 3 views
0

데비안에서 maven 프로젝트를 Tomcat 7에 배포하려고 할 때 401 오류가 발생했습니다.tomcat-maven-plugin으로 배포

 org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:redeploy (default-cli) on project ClientPortal: Cannot invoke Tomcat manager 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:217) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84) 
     at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59) 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183) 
     at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161) 
     at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
     at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
     at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
     at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
     at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) 
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 
     at java.lang.reflect.Method.invoke(Method.java:606) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
     at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
Caused by: org.apache.maven.plugin.MojoExecutionException: Cannot invoke Tomcat manager 
     at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:149) 
     at org.codehaus.mojo.tomcat.AbstractWarCatalinaMojo.execute(AbstractWarCatalinaMojo.java:70) 
     at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101) 
     at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209) 
     ... 19 more 
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:8181/manager/text/deploy?path=%2FClientPortal&war=&update=true 
     at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626) 
     at org.codehaus.mojo.tomcat.TomcatManager.invoke(TomcatManager.java:604) 
     at org.codehaus.mojo.tomcat.TomcatManager.deployImpl(TomcatManager.java:662) 
     at org.codehaus.mojo.tomcat.TomcatManager.deploy(TomcatManager.java:295) 
     at org.codehaus.mojo.tomcat.AbstractDeployWarMojo.deployWar(AbstractDeployWarMojo.java:85) 
     at org.codehaus.mojo.tomcat.AbstractDeployMojo.invokeManager(AbstractDeployMojo.java:85) 
     at org.codehaus.mojo.tomcat.AbstractCatalinaMojo.execute(AbstractCatalinaMojo.java:141) 
     ... 22 more 

내 바람둥이 여기에 포트 8181에서 실행되고 내 pom.xml 파일입니다

<build> 
      <sourceDirectory>src</sourceDirectory> 
      <plugins> 
        <plugin> 
          <groupId>org.apache.tomcat.maven</groupId> 
          <artifactId>tomcat7-maven-plugin</artifactId> 
          <version>2.2</version> 
          <configuration> 
            <url>http://localhost:8181/manager/text</url> 
            <server>Tomcat7</server> 
            <username>admin</username> 
            <password>tomcat</password> 
            <path>/ClientPortal</path> 
          </configuration> 
        </plugin> 
        <plugin> 
          <artifactId>maven-war-plugin</artifactId> 
          <version>2.3</version> 
          <configuration> 
            <warSourceDirectory>WebContent</warSourceDirectory> 
            <failOnMissingWebXml>false</failOnMissingWebXml> 
          </configuration> 
        </plugin> 
        <plugin> 
          <artifactId>maven-compiler-plugin</artifactId> 
          <version>3.1</version> 
          <configuration> 
            <source>1.7</source> 
            <target>1.7</target> 
          </configuration> 
        </plugin> 
      </plugins> 
    </build> 

나는 또한에 Settings.XML의 작성을 시도

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

바람둥이-users.xml에서 내 .m2 디렉토리

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 
         http://maven.apache.org/xsd/settings-1.0.0.xsd"> 
    <localRepository/> 
    <interactiveMode/> 
    <usePluginRegistry/> 
    <offline/> 
    <pluginGroups/> 
    <servers> 
     <server> 
     <id>Tomcat7</id> 
     <username>admin</username> 
     <password>tomcat</password> 
     </server> 
    </servers> 
    <mirrors/> 
    <proxies/> 
    <profiles/> 
    <activeProfiles/> 
</settings> 

답변

0

오류 4 01은 비인증 URL에 대한 플래그입니다. 유효한 사용자/암호를 확인하십시오.

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

변경 바람둥이-users.xml에서 내가 계속 변화하지만 행운을 만들었습니다

+0

관리자 로그인에 노력합니다. – enfany