无法使用tomcat-maven-plugin从另一台计算机(windows 7)部署到tomcat 7(在window



我正在尝试在网络上的另一台计算机上运行的Tomcat 7上构建和部署Struts2 "教程"示例项目。项目在本地机器上构建和部署都很好,但是在远程计算机上部署时出现错误(如下所示)。

pom.xml文件中的设置如下:

<plugin>
             <groupId>org.codehaus.mojo</groupId>
             <artifactId>tomcat-maven-plugin</artifactId>
             <version>1.1</version>
             <configuration>
                 <url>http://10.0.0.220:8080/manager</url>
                  <server>myserver</server>
             </configuration>
        </plugin>

where, 10.0.0.220:8080是我试图部署WAR文件的计算机地址。

我的本地机器中Maven的settings.xml中的代码如下:

<server>
        <id>myserver</id>
        <username>travel</username>
        <password>travel</password>
</server>

我试图部署的计算机上的Tomcat 7.0/conf/Tomcat -users.xml文件中的代码是:

<user name = "travel" password = "travel" roles = "manager-gui,admin-gui" />

此外,我可以从本地计算机的web浏览器访问http://10.0.0.220:8080/manager并手动部署WAR文件。

但是,当我在本地机器上使用mvn tomcat:deploy时,它显示BUILD FAILURE

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

和当我使用mvn tomcat:run我得到以下:

    INFO: ... initialized Struts-Spring integration successfully
Apr 21, 2011 3:39:22 PM org.apache.coyote.http11.Http11Protocol init
SEVERE: Error initializing endpoint
java.net.SocketException: Unrecognized Windows Sockets error: 0: JVM_Bind
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:365)
        at java.net.ServerSocket.bind(ServerSocket.java:319)
        at java.net.ServerSocket.<init>(ServerSocket.java:185)
        at java.net.ServerSocket.<init>(ServerSocket.java:141)
        at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(De
faultServerSocketFactory.java:50)
        at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:538)
        at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
        at org.apache.catalina.connector.Connector.initialize(Connector.java:101
4)
        at org.apache.catalina.startup.Embedded.start(Embedded.java:830)
        at org.codehaus.mojo.tomcat.AbstractRunMojo.startContainer(AbstractRunMo
jo.java:558)
        at org.codehaus.mojo.tomcat.AbstractRunMojo.execute(AbstractRunMojo.java
:255)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(Default
BuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor
.java:209)
        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.buildProje
ct(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProje
ct(LifecycleModuleBuilder.java:59)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBu
ild(LifecycleStarter.java:183)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(Lifecycl
eStarter.java:161)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
        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:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Laun
cher.java:290)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.jav
a:230)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(La
uncher.java:409)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:
352)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.330s
[INFO] Finished at: Thu Apr 21 15:39:23 IST 2011
[INFO] Final Memory: 5M/10M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:run (de
fault-cli) on project tutorial: Could not start Tomcat: Protocol handler initial
ization failed: java.net.SocketException: Unrecognized Windows Sockets error: 0:
 JVM_Bind -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.

是什么导致了这个问题?我已经关闭了windows防火墙,UAC设置为"Never Notify"。

另外,如果我在本地机器(运行tomcat 5)上使用mvn tomcat:deploy,它可以很好地部署。

我遇到了同样的问题。在Tomcat 7中,默认部署URL从http://localhost:8080/manager更改为http://localhost:8080/manager/html

相关内容

  • 没有找到相关文章

最新更新