4 Replies Latest reply on Dec 31, 2008 2:25 AM by ron_sigal

    The invoker for locator (InvokerLocator [socket://xx.xx.xx.

    sreepraveen_2000

      Hi All,

      In my project we use remoting services to communicate between client and server.

      The server listens on a particular port say 5800, all the clients try to connect to server on that particular port giving their local port to communicate. (lets say local ports start from 5900 and increment by 1 for each client).

      Clients try to query heart beat from server every 3 minutes to keep the connection alive and sync with the server every time server restarts.

      The problem is during the restart of the server, not all the clients are able to connect back to the server, it is random some clients connect perfectly some clients throw below exception.

      
      2008-12-15 15:47:09,905 FATAL [com.xxxxx.datamodel.client.TransporterClients] The invoker for locator (InvokerLocator [socket://10.10.227.121:5901/?serializationtype=jboss]) is already in use by another Connector. Either change the locator or add new handlers to existing Connector.
      com.xxxxx.datamodel.DMException: The invoker for locator (InvokerLocator [socket://xx.xx.xxx.xxx:5901/?serializationtype=jboss]) is already in use by another Connector. Either change the locator or add new handlers to existing Connector.
       at com.xxxxx.datamodel.client.TransporterClients.createServer(TransporterClients.java:171)
       at com.xxxxx.datamodel.client.TransporterClients.<init>(TransporterClients.java:59)
       at com.xxxxx.datamodel.client.DriverManager.<init>(DriverManager.java:17)
       at com.xxxxx.datamodel.client.remoting.ConnectionManager.init(ConnectionManager.java:44)
       at com.xxxxx.datamodel.client.remoting.ConnectionManager.<init>(ConnectionManager.java:39)
       at com.xxxxx.datamodel.client.remoting.ConnectionManagerHelper.getConnection(ConnectionManagerHelper.java:38)
       at com.xxxxx.datamodel.client.remoting.ConnectionManager.getConnectionManager(ConnectionManager.java:104)
       at com.xxxxx.sms.SMSCommunicationService.getRemoteSMSGatewayConnection(SMSCommunicationService.java:134)
       at com.xxxxx.sms.SMSCommunicationService.access$100(SMSCommunicationService.java:44)
       at com.xxxxx.sms.SMSCommunicationService$HeartBeatTask.run(SMSCommunicationService.java:160)
       at java.util.TimerThread.mainLoop(Timer.java:512)
       at java.util.TimerThread.run(Timer.java:462)
      Caused by: org.jboss.remoting.InvalidConfigurationException: The invoker for locator (InvokerLocator [socket://10.10.227.121:5901/?serializationtype=jboss]) is already in use by another Connector. Either ch
      ange the locator or add new handlers to existing Connector.
       at org.jboss.remoting.InvokerRegistry.createServerInvoker(InvokerRegistry.java:519)
       at org.jboss.remoting.transport.Connector.init(Connector.java:396)
       at org.jboss.remoting.transport.Connector.create(Connector.java:782)
       at org.jboss.remoting.transporter.TransporterServer.getConnector(TransporterServer.java:163)
       at org.jboss.remoting.transporter.TransporterServer.<init>(TransporterServer.java:105)
       at org.jboss.remoting.transporter.TransporterServer.createTransporterServer(TransporterServer.java:292)
       at org.jboss.remoting.transporter.TransporterServer.createTransporterServer(TransporterServer.java:260)
       at org.jboss.remoting.transporter.TransporterServer.createTransporterServer(TransporterServer.java:502)
       at com.xxxxx.datamodel.client.TransporterClients.createServer(TransporterClients.java:168)
       ... 11 more
      
      


      The code to establish client connection to server is given below.

      TransporterClients(String pRmtURL, String pLclURL) throws DMException {
       rmturl = pRmtURL+"/?serializationtype=jboss";
       lclurl = getLocalURL(pLclURL);
       logger.info("Remote URL: "+rmturl);
       logger.info("Local URL: "+lclurl);
       try {
       manager = (com.xxxxx.datamodel.rmt.DriverManager) TransporterClient
       .createTransporterClient(rmturl,
       com.xxxxx.datamodel.rmt.DriverManager.class);
       driver = (com.xxxxx.datamodel.rmt.Driver) TransporterClient
       .createTransporterClient(rmturl,
       com.xxxxx.datamodel.rmt.Driver.class);
       connection = (com.xxxxx.datamodel.rmt.Connection) TransporterClient
       .createTransporterClient(rmturl,
       com.xxxxx.datamodel.rmt.Connection.class);
       stmt = (com.xxxxx.datamodel.rmt.Statement) TransporterClient
       .createTransporterClient(rmturl,
       com.xxxxx.datamodel.rmt.Statement.class);
       observerserver = new Observable();
       observer = createServer(observerserver, com.xxxxx.datamodel.rmt.Observer.class.getName());
       } catch (Exception e) {
       logger.fatal(e.getLocalizedMessage(), e);
       close();
       throw new DMException(e);
       }
       }
      
      


      The close method is given below.

      
      void close() {
       if(observer!=null)
       observer.stop();
       if(stmt!=null)
       TransporterClient.destroyTransporterClient(stmt);
       if(connection!=null)
       TransporterClient.destroyTransporterClient(connection);
       if(driver!=null)
       TransporterClient.destroyTransporterClient(driver);
       if(manager!=null)
       TransporterClient.destroyTransporterClient(manager);
       }
      
      


      If there is any exception in the connection code it will try to close and try to recreate the connections in the next cycle.

      I think the closing code is not releasing all the resources used by the client.

      Any help would be greatly appreciated.

      Thanks.

        • 1. Re:  The invoker for locator (InvokerLocator [socket://xx.xx
          sreepraveen_2000

          JBossRemoting Version 2.2.2.SP1

          Application server is JBoss 4.2.2.GA

          • 2. Re:  The invoker for locator (InvokerLocator [socket://xx.xx
            sreepraveen_2000

            I tried to fix the invoker problem by removing the local url from invoker registry.

            but, i get a different problem now.

            
            Caused by: java.net.BindException: Address already in use
             at java.net.PlainSocketImpl.socketBind(Native Method)
             at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)
             at java.net.ServerSocket.bind(ServerSocket.java:319)
             at java.net.ServerSocket.<init>(ServerSocket.java:185)
             at javax.net.DefaultServerSocketFactory.createServerSocket(ServerSocketFactory.java:169)
             at org.jboss.remoting.transport.socket.SocketServerInvoker.createServerSocket(SocketServerInvoker.java:264)
             at org.jboss.remoting.transport.socket.SocketServerInvoker.start(SocketServerInvoker.java:193)
             at org.jboss.remoting.transport.Connector.start(Connector.java:322)
             at org.jboss.remoting.transporter.TransporterServer.start(TransporterServer.java:193)
             at org.jboss.remoting.transporter.TransporterServer.createTransporterServer(TransporterServer.java:293)
             at org.jboss.remoting.transporter.TransporterServer.createTransporterServer(TransporterServer.java:260)
             at org.jboss.remoting.transporter.TransporterServer.createTransporterServer(TransporterServer.java:502)
             at com.xxxxx.datamodel.client.TransporterClients.createServer(TransporterClients.java:181)
            
            


            The sockets are not being released. Is there a way I can close the sockets externally.

            • 3. Re:  The invoker for locator (InvokerLocator [socket://xx.xx
              sreepraveen_2000

              any help from remoting group ?

              Is this a know bug ?

              when i restart the server clients connections recover 9 out of 10 times, the one time when it doesn't recover we need to stop all the clients and start again..

              is there a workaround ..

              thanks.

              • 4. Re:  The invoker for locator (InvokerLocator [socket://xx.xx
                ron_sigal

                It looks like you're creating TransporterServers on the client side, right? I'm guessing each client has a TransporterServer to handle calls from the server to the client, right? So, when you recreate a client, you're also recreating a TransporterServer.

                The exception " The invoker for locator ... is already in use by another Connector." is thrown when you try to create a server (org.jboss.remoting.transport.Connector) with an InvokerLocator that is currently associated with a server in the InvokerRegistry. So, clearly, when your clients are shutting down, the TransporterServer's Connector is not shutting down.

                When you explicitly remove the InvokerLocator from the InvokerRegistry, you're just masking the problem: the server is still running and its ServerSocket is still bound.

                Now, I don't know why your TransportServer isn't getting closed. Check your code ... .