无法在Tomcat 8.0.2上的Netbeans中部署我的Web应用程序(得到以下错误)

时间:2016-01-28 14:55:35

标签: java tomcat netbeans

我已经阅读了很多有关此问题的主题,但没有一个解决方案适合我。 我正试图解决这个问题。我的Web应用程序运行良好,然后几天前,当我们尝试运行应用程序时,我开始收到以下异常 或者只是启动Tomcat(来自Netbeans)。有时(很少),Tomcat确实启动但Netbeans8.1仍然无法部署应用程序(部署错误:启动Tomcat失败)。

 28-Jan-2016 15:32:17.947 SEVERE [main]  

org.apache.coyote.AbstractProtocol.init Failed to initialize end point associated with ProtocolHandler ["ajp-apr-8009"]
 java.lang.Exception: Socket bind failed: [730048] Only one usage of each socket address (protocol/network address/port) is normally permitted.  
    at org.apache.tomcat.util.net.AprEndpoint.bind(AprEndpoint.java:471)
    at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:742)
    at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:457)
    at org.apache.catalina.connector.Connector.initInternal(Connector.java:960)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:567)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:576)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)

28-Jan-2016 15:32:17.947 SEVERE [main] org.apache.catalina.core.StandardService.initInternal Failed to initialize connector [Connector[AJP/1.3-8009]]
 org.apache.catalina.LifecycleException: Failed to initialize component [Connector[AJP/1.3-8010]]
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:106)
    at org.apache.catalina.core.StandardService.initInternal(StandardService.java:567)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:851)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:102)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:576)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:599)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:310)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:484)
...

我应该说我的同事拥有相同的Tomcat配置和版本,但问题只存在于我的电脑上。无论如何,这是server.xml的一部分

<Connector connectionTimeout="20000" port="8081" protocol="HTTP/1.1" redirectPort="8443"/>
<!-- A "Connector" using the shared thread pool-->
<!--
<Connector executor="tomcatThreadPool"
           port="8080" protocol="HTTP/1.1"
           connectionTimeout="20000"
           redirectPort="8443" />
-->
<!-- Define a SSL/TLS HTTP/1.1 Connector on port 8443
     This connector uses the NIO implementation that requires the JSSE
     style configuration. When using the APR/native implementation, the
     OpenSSL style configuration is required as described in the APR/native
     documentation -->
<!--
<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"
           maxThreads="150" SSLEnabled="true" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" />
-->

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"/>

据我所知(我已经使用过netstat -aon),没有其他进程正在使用该端口(8009),我尝试了其他端口但无济于事。

谢谢

2 个答案:

答案 0 :(得分:1)

似乎8009端口正在使用某些

请在窗口

中使用以下命令检查您的端口是否正在运行
netstat -aon | findstr 8009

如果您发现任何使用

,请终止该过程
taskkill /pid <pid>

答案 1 :(得分:0)

我通过重新安装Netbeans,重新创建所有项目(重新导入工作区)并重新安装Tomcat来解决我的问题。

似乎Netbeans有时(在我的情况下部署)无法挽回Tomcat安装,唯一的方法(或至少最简单的方法)是重新安装所有东西,在我的情况下需要大约30-40分钟。 (我花了几天时间尝试进行故障排除)