【问题标题】:Can't deploy my web application in Netbeans on Tomcat 8.0.2 (getting below error)无法在 Tomcat 8.0.2 上的 Netbeans 中部署我的 Web 应用程序(出现以下错误)
【发布时间】:2016-01-28 14:55:34
【问题描述】:

我已经阅读了很多关于这个问题的帖子,但没有一个解决方案对我有用。 我要疯了,试图解决这个问题。我的 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 配置和版本,但问题只存在于我的 PC 上。无论如何,这是 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),我尝试了其他端口但无济于事。

谢谢

【问题讨论】:

  • 神奇地被激活的软件防火墙?我不会太相信你得到的确切错误,症状是“无法在那个端口上监听”。一个通常的嫌疑人是已经在那里听的东西,但这不是唯一的可能性。
  • 注释掉 AJP 连接器:。在Netbeans中没有用,
  • @Stefan,我可能会尝试这样做,因为我并没有在 Web 服务器后面运行 Tomcat。

标签: java tomcat netbeans


【解决方案1】:

似乎 8009 端口正在使用某些地方

请检查您的端口是否正在运行,在窗口中使用以下命令

netstat -aon | findstr 8009

如果你发现任何使用

的进程,则终止该进程
taskkill /pid <pid>

【讨论】:

  • 我试过了,但 8009 只被 Java.exe 使用(我猜是 Tomcat)
【解决方案2】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-22
    • 2014-05-06
    • 2014-03-01
    • 2016-08-03
    • 2020-01-17
    • 1970-01-01
    相关资源
    最近更新 更多