3 Replies Latest reply on Apr 20, 2003 1:08 PM by Adrian Brock

    java.net.BindException: Address in use: connect

    kadawr Newbie

      Hi,

      There is a program which publishes messages:
      ...
      topicConnection =
      topicConnectionFactory.createTopicConnection();
      topicSession =
      topicConnection.createTopicSession(false,
      Session.AUTO_ACKNOWLEDGE);
      topicConnection.start();
      topicPublisher = topicSession.createPublisher(topic);
      message = topicSession.createObjectMessage(groups);
      topicPublisher.publish(message);
      topicPublisher.close();
      log.debug("message published");
      } catch (JMSException e) {
      if (log.isDebugEnabled()) {
      log.debug("failed for groups" + groups.toString());
      }
      log.error("unexpected exception", e);
      jmse = e;
      } finally {
      if (topicConnection != null) {
      try {
      topicConnection.stop();
      topicSession.close();
      topicConnection.close();
      topicConnection = null;
      ....

      It works fine many times, then errors appear in the jboss log:

      ERROR [org.jboss.mq.il.oil.OILClientIL] Cannot connect to the ConnectionReceiver/Server
      java.net.BindException: Address in use: connect
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:323)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:136)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:123)
      at java.net.Socket.(Socket.java:273)
      at java.net.Socket.(Socket.java:127)
      at org.jboss.mq.il.oil.OILClientIL.createConnection(OILClientIL.java:175)
      at org.jboss.mq.il.oil.OILClientIL.checkSocket(OILClientIL.java:156)

      and finally my program fails:

      org.jboss.mq.SpyJMSException: Cannot authenticate user; - nested throwable: (java.net.BindException: Address in use: connect)
      at org.jboss.mq.Connection.authenticate(Connection.java:876)
      at org.jboss.mq.Connection.(Connection.java:232)
      at org.jboss.mq.Connection.(Connection.java:310)
      at org.jboss.mq.SpyConnection.(SpyConnection.java:59)
      at org.jboss.mq.SpyConnectionFactory.createTopicConnection(SpyConnectionFactory.java:78)
      at com.supportwizard.permissionsbeans.synchronizer.GroupChangePermissionPublisher.Publisher(GroupChangePermissionPublisher.java:101)

      at the line

      topicConnection =
      topicConnectionFactory.createTopicConnection();

      Does anyone have any idea what's wrong?
      jboss-3.0.7

      Thanks, Oleg