0 Replies Latest reply on May 15, 2013 1:58 PM by Laxmi Chalasani

    jboss java application creating numerous connections on machine

    Laxmi Chalasani Newbie

      Hello,

       

      We are using Jboss-5.1.0.GA as our messaging server for our application. We have the maxclientsize set to 300. But we are seeing numerour connections on the application machine when we do netstat.

      Also the java application is crashing unable to process the Messages from the DB.

       

      Below is the snippet of code we are using to QueueConnections. We are using java 1.6. We are havinng issues after upgarding to jboss5 and jdk1.6. We had no issues with the load when running on application on java 1.3 using jboss-3.2.2.

      We are using mssql 2000 for database for JBOSS and Java application.

       

      We see the below exception when clients have issue connecting to receive the jboss messages:

      CommunicationException: null

      1. Threw Exception...javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 172.17.100.202; nested exception is:

      java.net.ConnectException: Connection refused: connect]

      javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 172.17.100.202; nested exception is:

      java.net.ConnectException: Connection refused: connect]

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:839)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)

      at javax.naming.InitialContext.lookup(InitialContext.java:392)

      at com.adsretail.nextor.jms.ADS_JMS_Server.hostStart(ADS_JMS_Server.java:131)

      at com.adsretail.nextor.jms.ADS_BaseReceive_MQ.checkConnection(ADS_BaseReceive_MQ.java:105)

      at com.adsretail.nextor.jms.ADS_BaseReceive_MQ.reinitialize(ADS_BaseReceive_MQ.java:171)

      at com.adsretail.nextor.jms.ADS_BaseReceive_MQ.onException(ADS_BaseReceive_MQ.java:177)

      at org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener.handleConnectionException(ConsolidatedRemotingConnectionListener.java:113)

      at org.jboss.remoting.ConnectionValidator$1.run(ConnectionValidator.java:744)

      Caused by: java.rmi.ConnectException: Connection refused to host: 172.17.100.202; nested exception is:

      java.net.ConnectException: Connection refused: connect

      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)

      at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)

      at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)

      at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)

      at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)

      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)

      ... 8 more

      Caused by: java.net.ConnectException: Connection refused: connect

      at java.net.PlainSocketImpl.socketConnect(Native Method)

      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)

      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)

      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)

      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)

      at java.net.Socket.connect(Socket.java:519)

      at java.net.Socket.connect(Socket.java:469)

      at java.net.Socket.<init>(Socket.java:366)

      at java.net.Socket.<init>(Socket.java:180)

      at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)

      at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)

      at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)

      ... 13 more

       

      Any input is appericiated.

      Thanks,

      Laxmi

       

      QueueConnectionFactory hostQcf = null;
                  if(appServer.equalsIgnoreCase("JBOSS"))
                  {
             //JBOSS environment
             Hashtable<String,String> env = new Hashtable<String,String>();
             env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
             env.put(Context.PROVIDER_URL, "jnp://" + ipAddress + ":1099");
             env.put(Context.OBJECT_FACTORIES, "org.jboss.naming:org.jnp.interfaces");
             ErrorLog1.getInstance().logMessage("ipAddress: " + ipAddress);
             //cgduan jdk1.6 update
             if (JAVA_VERSION.indexOf("1.6") == -1){
               hostCtx = NamingManager.getInitialContext(env);
               hostQcf = (QueueConnectionFactory)hostCtx.lookup("OIL2ConnectionFactory");//SCO3181 nt 11/25/2003 //SC04617 nt 08/30/04
                   }else{
                    hostCtx_JDK16 = new InitialContext(env);
                    hostQcf = (QueueConnectionFactory) hostCtx_JDK16.lookup("ConnectionFactory");
                   }
           //JBOSS environment

                  }

       

      ::::

      hostConn    = hostQcf.createQueueConnection();

                  hostSession = hostConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);

         //TS8577 mduan

         qServerStart = true;

       

       

       

       

       

      public  void recvAsync() throws Exception

          {

              try

              {

               if (JAVA_VERSION.indexOf("1.6") == -1){

                hostConn.setExceptionListener(this);//SC0070 nt 08/14/2007

                   hostQueue = (Queue)hostCtx.lookup(getQueueName());

                   QueueReceiver recv = hostSession.createReceiver(hostQueue);

                   recv.setMessageListener(this);

                   hostConn.start();

               }else{

                         hostConn.setExceptionListener(this);

                hostQueue = (Queue)hostCtx_JDK16.lookup(getQueueName());

                      // create a queue receiver

                      QueueReceiver recv = hostSession.createReceiver(hostQueue);

                      // set an asynchronous message listener

                      recv.setMessageListener(this);

                      hostConn.start();

               }

              } catch(Exception e) {

               throw e;

              }

          }