2 Replies Latest reply on Sep 30, 2013 12:15 PM by Kaushik Parasam

    Connecting to JBoss server(s) through VIP

    Kaushik Parasam Newbie

      Hi, I've a JBoss-7.1.1-Final domain cluster running (Master-slave). I've a Virtual IP on the load balancer. The client interacts through VIP to JBoss servers. The problem is when, say the client is continuously sending messages (say ~1000 in a loop to Master - picked up by VIP routing). The Master is initially up consuming messages. Then I bring down the Master, which makes client not to send messages(fine). But when I bring back the Master up (and the loop is still going), it cannot connect to Master through VIP. I get [javax.naming.NamingException: Failed to lookup [Root exception is org.jboss.remoting3.NotOpenException: Writes closed]. I'm creating looking up through InitialContext(and JNDI) for every iteration. Not sure what's causing the issue. The VIP(or load balancer doens't seem to be the problem). Any help would be appreciated. Thanks !.

        • 1. Re: Connecting to JBoss server(s) through VIP
          Kaushik Parasam Newbie

          On further testing, its not just with VIP, even if I try an actual IP, the initialContext.lookup("jms/RemoteConnectionFactory") fails to get connection object after restart of JBoss server. Please let me know if anyone has experienced a similar problem or a possible solution for this. Thanks.

          Here's my code:

          public JMSSender(String message) throws JMSException, NamingException, Exception {

           

          jmsHostIP = "10.0.40.100:4447";

          connectToHost = "remote://"+jmsHostIP;

          appUser = "user";

          appPwd = "pwd";

          destinationQueue = "jms/queue/test";

                 

          envProp.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

          envProp.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");

          envProp.setProperty(Context.PROVIDER_URL, connectToHost);

          envProp.put(Context.SECURITY_PRINCIPAL, appUser);

          envProp.put(Context.SECURITY_CREDENTIALS, appPwd);

           

          InitialContext initialContext = new InitialContext(envProp);

          Object conObject = initialContext.lookup("jms/RemoteConnectionFactory");

          QueueConnectionFactory qcf = (QueueConnectionFactory) conObject;

          queCon = qcf.createQueueConnection(appUser, appPwd); // Get the connection from the desired ConnectionFactory with credentials

          queue = (Queue) initialContext.lookup(destinationQueue);

          queCon.start();

          session = queCon.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

          sender = session.createSender(queue);

           

          sender.send(message);

          }

           

          main {

              for(int i=0;i<1000;i++) {

                  new JMSSender("message");

              }

          }

          • 2. Re: Connecting to JBoss server(s) through VIP
            Kaushik Parasam Newbie

            I think found the answer. The initialContext has to be closed after it is used (not to wait the garbage collector to free it up). Now, there's no problem reconnecting to JBoss server after it restarts.