<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">

<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>

                                <td>

                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="https://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>

                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px;  -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
    jboss java application creating numerous connections on machine
</h3>
<span style="margin-bottom: 10px;">
    created by <a href="https://community.jboss.org/people/laxminc">Laxmi Chalasani</a> in <i>JBoss Messaging</i> - <a href="https://community.jboss.org/message/817887#817887">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">

<div class="jive-rendered-content"><p>Hello,</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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. </p><p>Also the java application is crashing unable to process the Messages from the DB.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>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.</p><p>We are using mssql 2000 for database for JBOSS and Java application.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>We see the below exception when clients have issue connecting to receive the jboss messages:</p><p>CommunicationException: null</p><p>1. Threw Exception...javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 172.17.100.202; nested exception is: </p><p> java.net.ConnectException: Connection refused: connect]</p><p>javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 172.17.100.202; nested exception is: </p><p> java.net.ConnectException: Connection refused: connect]</p><p> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:839)</p><p> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)</p><p> at javax.naming.InitialContext.lookup(InitialContext.java:392)</p><p> at com.adsretail.nextor.jms.ADS_JMS_Server.hostStart(ADS_JMS_Server.java:131)</p><p> at com.adsretail.nextor.jms.ADS_BaseReceive_MQ.checkConnection(ADS_BaseReceive_MQ.java:105)</p><p> at com.adsretail.nextor.jms.ADS_BaseReceive_MQ.reinitialize(ADS_BaseReceive_MQ.java:171)</p><p> at com.adsretail.nextor.jms.ADS_BaseReceive_MQ.onException(ADS_BaseReceive_MQ.java:177)</p><p> at org.jboss.jms.client.remoting.ConsolidatedRemotingConnectionListener.handleConnectionException(ConsolidatedRemotingConnectionListener.java:113)</p><p> at org.jboss.remoting.ConnectionValidator$1.run(ConnectionValidator.java:744)</p><p>Caused by: java.rmi.ConnectException: Connection refused to host: 172.17.100.202; nested exception is: </p><p> java.net.ConnectException: Connection refused: connect</p><p> at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:601)</p><p> at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:198)</p><p> at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:184)</p><p> at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:110)</p><p> at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)</p><p> at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:726)</p><p> ... 8 more</p><p>Caused by: java.net.ConnectException: Connection refused: connect</p><p> at java.net.PlainSocketImpl.socketConnect(Native Method)</p><p> at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)</p><p> at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)</p><p> at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)</p><p> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)</p><p> at java.net.Socket.connect(Socket.java:519)</p><p> at java.net.Socket.connect(Socket.java:469)</p><p> at java.net.Socket.&lt;init&gt;(Socket.java:366)</p><p> at java.net.Socket.&lt;init&gt;(Socket.java:180)</p><p> at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)</p><p> at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)</p><p> at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:595)</p><p> ... 13 more</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>Any input is appericiated. </p><p>Thanks,</p><p>Laxmi</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> QueueConnectionFactory hostQcf = null;<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if(appServer.equalsIgnoreCase("JBOSS"))<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {<br/>&#160;&#160;&#160;&#160;&#160;&#160; //JBOSS environment<br/>&#160;&#160;&#160;&#160;&#160;&#160; Hashtable&lt;String,String&gt; env = new Hashtable&lt;String,String&gt;();<br/>&#160;&#160;&#160;&#160;&#160;&#160; env.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");<br/>&#160;&#160;&#160;&#160;&#160;&#160; env.put(Context.PROVIDER_URL, "jnp://" + ipAddress + ":1099"); <br/>&#160;&#160;&#160;&#160;&#160;&#160; env.put(Context.OBJECT_FACTORIES, "org.jboss.naming:org.jnp.interfaces");<br/>&#160;&#160;&#160;&#160;&#160;&#160; ErrorLog1.getInstance().logMessage("ipAddress: " + ipAddress);<br/>&#160;&#160;&#160;&#160;&#160;&#160; //cgduan jdk1.6 update<br/>&#160;&#160;&#160;&#160;&#160;&#160; if (JAVA_VERSION.indexOf("1.6") == -1){<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostCtx = NamingManager.getInitialContext(env);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostQcf = (QueueConnectionFactory)hostCtx.lookup("OIL2ConnectionFactory");//SCO3181 nt 11/25/2003 //SC04617 nt 08/30/04<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else{<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostCtx_JDK16 = new InitialContext(env);<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostQcf = (QueueConnectionFactory) hostCtx_JDK16.lookup("ConnectionFactory");<br/>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }<br/>&#160;&#160;&#160;&#160; //JBOSS environment</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p>::::</p><p> hostConn&#160;&#160;&#160; = hostQcf.createQueueConnection();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostSession = hostConn.createQueueSession(false, QueueSession.AUTO_ACKNOWLEDGE);</p><p>&#160;&#160; //TS8577 mduan</p><p>&#160;&#160; qServerStart = true;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p style="min-height: 8pt; height: 8pt; padding: 0px;">&#160;</p><p> public&#160; void recvAsync() throws Exception</p><p>&#160;&#160;&#160; {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; try</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; {</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (JAVA_VERSION.indexOf("1.6") == -1){</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostConn.setExceptionListener(this);//SC0070 nt 08/14/2007</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostQueue = (Queue)hostCtx.lookup(getQueueName());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueReceiver recv = hostSession.createReceiver(hostQueue);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; recv.setMessageListener(this);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostConn.start();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }else{</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostConn.setExceptionListener(this);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostQueue = (Queue)hostCtx_JDK16.lookup(getQueueName());</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // create a queue receiver</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; QueueReceiver recv = hostSession.createReceiver(hostQueue);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; // set an asynchronous message listener</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; recv.setMessageListener(this);</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; hostConn.start();</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; } catch(Exception e) { </p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; throw e;</p><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</p><p>&#160;&#160;&#160; }</p></div>

<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
    <p style="margin: 0;">Reply to this message by <a href="https://community.jboss.org/message/817887#817887">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in JBoss Messaging at <a href="https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042">Community</a></p>
</div></td>
                        </tr>
                    </tbody>
                </table>


                </td>
            </tr>
        </tbody>
    </table>

</div>

</body>
</html>