0 Replies Latest reply on May 26, 2006 9:28 AM by jayseletz

    Detect Protocol handler initialization failed or else cause

    jayseletz

      In the case where a tomcat connector http or https port fails to initialize due to a "java.net.BindException: Address already in use" exception, I'd either like to configure things to cause the JBoss server to fail to initialize and shutdown, or somehow detect this from within our web app.

      The problem we have is that JBoss still initializes and just displays this issue as a warning only, and so although the server starts, the web application is not available on all configured ports.

      I've tried making JMX calls to find the connector mbeans (type=Connector), but the first connector that fails is still found via JMX and I haven't figured out a way to tell if it's valid. Also, I've tried looking for mbeans of "type=ProtocolHandler", but they don't seem to be instantiated until after the web applications are initialized, and I'd like to be able detect this issue while our servlet is initializing.

      Any help on this issue would be greatly appreciated.

      The error logged during initialization is:
      2006-05-24 14:17:54,418 ERROR [org.apache.coyote.http11.Http11Protocol] Error initializing endpoint
      java.net.BindException: Address already in use: JVM_Bind:9992
      at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(PoolTcpEndpoint.java:297)
      at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:142)
      at org.apache.catalina.connector.Connector.initialize(Connector.java:928)
      at org.jboss.web.tomcat.tc5.StandardService.initialize(StandardService.java:688)
      at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:764)
      at org.apache.catalina.startup.Catalina.load(Catalina.java:490)
      at org.apache.catalina.startup.Catalina.start(Catalina.java:529)

      but at the end of inititalization only a warning is logged:
      2006-05-24 14:26:15,587 WARN [org.jboss.web.tomcat.tc5.Tomcat5] Failed to startConnectors
      LifecycleException: Protocol handler start failed: java.net.BindException: Address already in use: JVM_Bind:9992
      at org.apache.catalina.connector.Connector.start(Connector.java:1003)
      at org.jboss.web.tomcat.tc5.Tomcat5.startConnectors(Tomcat5.java:510)
      at org.jboss.web.tomcat.tc5.Tomcat5.handleNotification(Tomcat5.java:539)
      at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:585)
      at org.jboss.mx.notification.NotificationListenerProxy.invoke(NotificationListenerProxy.java:138)
      at $Proxy30.handleNotification(Unknown Source)
      at org.jboss.mx.util.JBossNotificationBroadcasterSupport.handleNotification(JBossNotificationBroadcasterSupport.java:112)
      at org.jboss.mx.util.JBossNotificationBroadcasterSupport.sendNotification(JBossNotificationBroadcasterSupport.java:93)
      at org.jboss.system.server.ServerImpl.sendNotification(ServerImpl.java:879)
      at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:468)
      at org.jboss.system.server.ServerImpl.start(ServerImpl.java:330)
      at org.jboss.Main.boot(Main.java:187)
      at org.jboss.Main$1.run(Main.java:438)
      at java.lang.Thread.run(Thread.java:595)
      2006-05-24 14:26:15,618 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.0.3 (build: CVSTag=JBoss_4_0_3 date=200510042324)] Started in 8m:35s:465ms