About SocketException

IOException2 in ClientThread is java.net.SocketException: Connection reset by pe
er: JVM_recv in socket input stream read,
this problem I dont understand,below is code,thank you
    public void run(){
      while(true){
         try{
           String message=read.readLine();
           if(message!=null && message.indexOf(".")==0){
              System.out.println("the received message is "+message);
              new testDriver(message);
         }catch(IOException e){
           System.out.println("IOException2 in ClientThread is "+e);
           System.exit(0);
    }

this problem now I solve,but another problem is coming;
another problem is:
when server is listenning:(the code below)
  int sPort=6633;
  ServerSocket sSocket=new ServerSocket(sPort);
  Socket cSocket=sSocket.accept();then how to close the connection in server?
by the way,how to close the connection in client as well?

Similar Messages

  • Getting error while configuring SharePoint 2013 that "SocketException was thrown with SocketError ConnectionRefused"

    Hi,
    I am installing the SharePoint-2013 on development virtual machine. and i have the following environment.
    Windows server : 2012
    SQL server 2012(enterprise edition)
    Active directory(domain) is configured on same server.
    for SharePoint configuration purpose i had  created SP_farm account with SQL server DB_creator,security admin etc rights.
    even though m facing this issue related with socket exception.
    Error in log file :
    04/08/2014 12:26:33  1  INF            Trying to see if port 35513 is free on machine SHAREPOINT2013.  Min port we will try is
     1024, Max port we will try is 49151
    04/08/2014 12:26:35  1  INF            A SocketException was thrown with SocketError ConnectionRefused
    04/08/2014 12:26:35  1  INF            Connect has been refused for port 35513, so we will consider this a free port
    04/08/2014 12:26:35  1  INF            Have not found a free port yet.  Number of tries is 1.  Min port we will try is 1024, Max
     port we will try is 49151
    04/08/2014 12:26:35  1  INF            Adding port 35513 to the exclusion list so it is not chosen again during this run
    So m bit confuse about is this error related to network issue or something else that i have to configure on server.
     any suggestion or reply will be appreciated..!:-) 
    Shiv

    Is the firewall turned on?
    Regards, Matthew
    MCPD | MCITP
    My Blog
    View
    Matthew Yarlett's profile
    See my webpart on the TechNet Gallery that allows administrative users to upload, crop and format user profile photos. Check it out here:
    Upload and Crop User Profile Photos

  • Client reconnection to conventional cluster taking about 9 minutes

    Hi,
    I've set up a 3 node OpenMq (4.4) conventional cluster and am having trouble with client reconnections when I simulate a halt on a node.
    I have two threads within the same process, sending to a pre-configured destination and replying using a temporary queue. Each have a JMS connection to the same home broker. If I bring the home broker down with either the imqcmd command or with a ctrl+c, the goodbye messages are sent and the client connections are immediately reestablished by the connection factory with the next broker. But... if I remove the broker from the cluster by simulating a BSOD, power failure, etc, no goodbye messages are sent (obviously) and the connected clients are left 'connected' to the dead broker and only reconnect to another broker after about 9 minutes.
    I read in the docs that the 'imqPingInterval' property can be used to test the client connections but it doesn't seem to be doing the trick. After I've cut the power to the broker's virtual machine, I'm seeing the ping messages in the logs, e.g.:
    FINEST: Outbound Packet:PING(54):296-127.0.1.1(bd:ea:13:9b:ae:a)-51155-1267024410861;BrokerAddress=10.59.148.9:7676(1082), ConnectionID=4090718717872600064, ReconnectEnabled: true, IsConnectedToHABroker: falseAt this point, telnet cannot connect to 10.59.148.9:7676 so it's definitely gone.
    Finally after about 9 minutes, the following shows up in the logs:
    24-Feb-2010 15:26:26 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwJMSException
    FINER: I501
    com.sun.messaging.jms.JMSException: [C4002]: Read packet failed. - cause: java.net.SocketException: No route to host
            at com.sun.messaging.jmq.jmsclient.ExceptionHandler.getJMSException(ExceptionHandler.java:380)
            at com.sun.messaging.jmq.jmsclient.ExceptionHandler.handleException(ExceptionHandler.java:331)
            at com.sun.messaging.jmq.jmsclient.ProtocolHandler.readPacket(ProtocolHandler.java:1796)
            at com.sun.messaging.jmq.jmsclient.ReadChannel.run(ReadChannel.java:1197)
            at java.lang.Thread.run(Thread.java:619)
    Caused by: java.net.SocketException: No route to host
            at java.net.SocketInputStream.socketRead0(Native Method)
            at java.net.SocketInputStream.read(SocketInputStream.java:129)
            at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
            at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
            at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
            at com.sun.messaging.jmq.io.ReadOnlyPacket.readFully(ReadOnlyPacket.java:271)
            at com.sun.messaging.jmq.io.ReadOnlyPacket.readFixedHeader(ReadOnlyPacket.java:191)
            at com.sun.messaging.jmq.io.ReadOnlyPacket.readPacket(ReadOnlyPacket.java:151)
            at com.sun.messaging.jmq.io.ReadWritePacket.readPacket(ReadWritePacket.java:82)
            at com.sun.messaging.jmq.jmsclient.ProtocolHandler.readPacket(ProtocolHandler.java:1758)
            ... 2 more
    24-Feb-2010 15:26:26 com.sun.messaging.jmq.jmsclient.ConnectionImpl logLifeCycle
    FINE: Connection closed.  The connection is closed due to a network problem, broker crashed, or internal error: BrokerAddress=10.59.148.9:7676(1082), ConnectionID=4090718717872604160, ReconnectEnabled: true, IsConnectedToHABroker: falseAnd we can then send/receive again.
    The connection factory details are as follows:
    Class:                  com.sun.messaging.ConnectionFactory
    getVERSION():           3.0
    isReadonly():           false
    getProperties():        {imqOverrideJMSPriority=false, imqConsumerFlowLimit=1000, imqOverrideJMSExpiration=false, imqAddressListIterations=1, imqLoadMaxToServerSession=true, imqConnectionType=TCP, imqPingInterval=30, imqSetJMSXUserID=false, imqConfiguredClientID=, imqSSLProviderClassname=com.sun.net.ssl.internal.ssl.Provider, imqJMSDeliveryMode=PERSISTENT, imqConnectionFlowLimit=1000, imqConnectionURL=http://localhost/imq/tunnel, imqBrokerServiceName=, imqJMSPriority=4, imqBrokerHostName=localhost, imqJMSExpiration=0, imqAckOnProduce=, imqEnableSharedClientID=false, imqAckTimeout=10000, imqAckOnAcknowledge=, imqConsumerFlowThreshold=50, imqDefaultPassword=guest, imqQueueBrowserMaxMessagesPerRetrieve=1000, imqDefaultUsername=guest, imqReconnectEnabled=true, imqConnectionFlowCount=100, imqAddressListBehavior=PRIORITY, imqReconnectAttempts=1, imqSetJMSXAppID=false, imqConnectionHandler=com.sun.messaging.jmq.jmsclient.protocol.tcp.TCPStreamHandler, imqSetJMSXRcvTimestamp=false, imqBrokerServicePort=0, imqDisableSetClientID=false, imqSetJMSXConsumerTXID=false, imqOverrideJMSDeliveryMode=false, imqBrokerHostPort=7676, imqQueueBrowserRetrieveTimeout=60000, imqSetJMSXProducerTXID=false, imqSSLIsHostTrusted=false, imqConnectionFlowLimitEnabled=false, imqReconnectInterval=3000, imqAddressList=mq://10.59.148.9,mq://10.59.148.17,mq://10.59.148.11, imqOverrideJMSHeadersToTemporaryDestinations=false}The brokers are virtualbox guests running 'WinXP 64' and the producer and consumer are both running on Ubuntu 9.10.
    Handling a machine failure seems like a pretty standard scenario for a cluster so I'm sure there's something I've mis-configured.
    Is there something I can do to fix this?
    If not, the only other alternatives I see are to either:
    1) Try the HA custer. But I'm not sure this will fix the problem if the client is waiting on a dead socket.
    2) Lower the message ack to something like 10 seconds and reconnect to the cluster for a retry every time we get a JMSException. But this is obviously not ideal either.
    Any suggestions would be great.
    Thanks,
    Nick

    Hi Nigel,
    The producer is configured to send messages every 5 seconds and the consumer is sitting with a message listener on the queue.
    The producer send is failing each time with the following trace...
    5-Feb-2010 12:13:19 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: Outbound Packet:OBJECT_MESSAGE(5):30-127.0.1.1(a2:3f:b1:e2:fd:33)-45573-1267099999075;BrokerAddress=10.59.148.9:7676(1184), ConnectionID=882185479630361088, ReconnectEnabled: true, IsConnectedToHABroker: false
    25-Feb-2010 12:13:19 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: sent packet ... OBJECT_MESSAGE(5):30-127.0.1.1(a2:3f:b1:e2:fd:33)-45573-1267099999075
    25-Feb-2010 12:13:19 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: Outbound Packet:PING(54):31-127.0.1.1(eb:66:36:db:8:79)-45574-1267099999156;BrokerAddress=10.59.148.9:7676(1184), ConnectionID=882185479630365184, ReconnectEnabled: true, IsConnectedToHABroker: false
    25-Feb-2010 12:13:19 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: sent packet ... PING(54):31-127.0.1.1(eb:66:36:db:8:79)-45574-1267099999156
    25-Feb-2010 12:13:24 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: Outbound Packet:PING(54):32-127.0.1.1(a2:3f:b1:e2:fd:33)-45573-1267100004156;BrokerAddress=10.59.148.9:7676(1184), ConnectionID=882185479630361088, ReconnectEnabled: true, IsConnectedToHABroker: false
    25-Feb-2010 12:13:24 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: sent packet ... PING(54):32-127.0.1.1(a2:3f:b1:e2:fd:33)-45573-1267100004156
    25-Feb-2010 12:13:24 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: Outbound Packet:PING(54):33-127.0.1.1(eb:66:36:db:8:79)-45574-1267100004156;BrokerAddress=10.59.148.9:7676(1184), ConnectionID=882185479630365184, ReconnectEnabled: true, IsConnectedToHABroker: false
    25-Feb-2010 12:13:24 com.sun.messaging.jmq.jmsclient.ProtocolHandler writePacketNoAck
    FINEST: sent packet ... PING(54):33-127.0.1.1(eb:66:36:db:8:79)-45574-1267100004156
    25-Feb-2010 12:13:29 com.sun.messaging.jmq.jmsclient.AckQueue printInfo
    WARNING: [W2003]: Broker not responding [OBJECT_MESSAGE(5)] for 10 seconds. Still trying..., broker addr=10.59.148.9:7676(1184), connectionID=882185479630361088, clientID=null, consumerID=14
    25-Feb-2010 12:13:29 com.sun.messaging.jmq.jmsclient.ExceptionHandler throwJMSException
    FINER: I501
    com.sun.messaging.jms.JMSException: [C4000]: Packet acknowledge failed. user=guest, broker=10.59.148.9:7676(1184)
         at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writePacketWithAck(ProtocolHandler.java:712)
         at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writePacketWithAck(ProtocolHandler.java:575)
         at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writePacketWithReply(ProtocolHandler.java:430)
         at com.sun.messaging.jmq.jmsclient.ProtocolHandler.writeJMSMessage(ProtocolHandler.java:1919)
         at com.sun.messaging.jmq.jmsclient.WriteChannel.sendWithFlowControl(WriteChannel.java:154)
         at com.sun.messaging.jmq.jmsclient.WriteChannel.writeJMSMessage(WriteChannel.java:107)
         at com.sun.messaging.jmq.jmsclient.SessionImpl.writeJMSMessage(SessionImpl.java:770)
         at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.writeJMSMessage(MessageProducerImpl.java:203)
         at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.writeJMSMessage(MessageProducerImpl.java:192)
         at com.sun.messaging.jmq.jmsclient.MessageProducerImpl.send(MessageProducerImpl.java:624)
         at com.sun.messaging.jmq.jmsclient.QueueSenderImpl.send(QueueSenderImpl.java:97)
         at uk.co.mydomain.jms.ClientJmsConnection.sendMessage(ClientJmsConnection.java:278)
         at uk.co.mydomain.jms.JmsClientMessageBroker.sendMessage(JmsClientMessageBroker.java:147)
         at test.uk.co.mydomain.messaging.quicktest.QuickTest$2.run(QuickTest.java:67)Is there any trace I could get that may be useful?
    Thanks,
    Nick

  • About jspsmartUpload

    Hi
    I'm trying to use jspsmartUpload to upload files to server. but jsp page throw an exception with the following error:
    Handler thread problem: java.net.socketexception: socket is closed
    can anyone help me and tell me how to solve this problem
    Thank u
    Iman

    Here is the code, may be anyone can tell me if something wrong in it
    <%@ page language="java" import="com.jspsmart.upload.*"%>
    <jsp:useBean id="myUpload" scope="page" class="com.jspsmart.upload.SmartUpload" />
    <HTML>
    <BODY BGCOLOR="white">
    <H1>jspSmartUpload : Sample 5</H1>
    <HR>
    <%
         // Initialization
         mySmartUpload.initialize(pageContext);
         // Upload
         myUpload.upload();          
         // Files
         out.println("<BR><STRONG>Display information about Files</STRONG><BR>");
         out.println("Number of files = " + myUpload.getFiles().getCount() + "<BR>");
         //out.println("Total size (bytes) = " + myUpload.getFiles().getSize() +"<BR>");
         for (int i=0;i<myUpload.getFiles().getCount();i++){
              out.print(myUpload.getFiles().getFile(i).getFieldName());
              if (!myUpload.getFiles().getFile(i).isMissing())
                   out.print(" = " + myUpload.getFiles().getFile(i).getFileName() + " (" + myUpload.getFiles().getFile(i).getSize() + ")");
              else
                   out.print(" = vide");          
              out.println("<BR>");
         // Request
         out.println("<BR><BR><STRONG>Display information about Requests</STRONG><BR>");
         // Retreive Requests' names
         java.util.Enumeration e = myUpload.getRequest().getParameterNames();
         // Retreive parameters
         while (e.hasMoreElements()) {
              String key = (String)e.nextElement();
              String[] values = myUpload.getRequest().getParameterValues(key);               
              // Browse the current parameter values
              for(int i = 0; i < values.length; i++) {
              out.print(key + " = ");
              out.print(values[i] + "<BR>");
    %>
    </BODY>
    </HTML>

  • JCOM on WLS 8.1 - SocketException: Socket closed

    After creating my application and accessing it - if I don't use it for a while
    I get the following exception when I access it. Other than creating a timer to
    ping it every 10 seconds or so - is there some way to keep the socket open?
    - Mike Reiche
    java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:124)
    at com.linar.jintegra.RpcConnectionHandler.send(RpcConnectionHandler.java:272)
    at com.linar.jintegra.Rpc.invoke(Rpc.java:239)
    at com.linar.jintegra.RemObjectExporter.invoke(RemObjectExporter.java:346)
    at com.linar.jintegra.StdObjRef.invoke(StdObjRef.java:57)
    at com.linar.jintegra.Dispatch.vtblInvoke(Dispatch.java:763)
    at excel._ApplicationProxy.getDefaultFilePath(_ApplicationProxy.java:1938)
    at excel.Application.getDefaultFilePath(Application.java:2237)

    Has anyone gotten an answer on this error? I also get a Socket Closed IOException
    after a couple of minutes of not communicating to a remote DCOM application.
    I also have to restart Weblogic to get it to communicate again. Works great as
    long as I make a request every 10 or 20 seconds.
    Rick Holland
    >
    I am having this exact same problem. I have a support case opened with
    BEA about
    it, and will let you know if I come up with a solution...
    In my case, however, I am gonna have a very hard time sending BEA a repeatable
    testcase that demonstrates this problem, as I access a DCOM app that
    I cant redistribute.
    Would your code be something that you can share with BEA? If so, that
    would be
    of tremendous help.
    "Mike Reiche" <mreiche@no_spam.com> wrote:
    After creating my application and accessing it - if I don't use it for
    a while
    I get the following exception when I access it. Other than creating
    a timer to
    ping it every 10 seconds or so - is there some way to keep the socket
    open?
    - Mike Reiche
    java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:124)
    at com.linar.jintegra.RpcConnectionHandler.send(RpcConnectionHandler.java:272)
    at com.linar.jintegra.Rpc.invoke(Rpc.java:239)
    at com.linar.jintegra.RemObjectExporter.invoke(RemObjectExporter.java:346)
    at com.linar.jintegra.StdObjRef.invoke(StdObjRef.java:57)
    at com.linar.jintegra.Dispatch.vtblInvoke(Dispatch.java:763)
    at excel._ApplicationProxy.getDefaultFilePath(_ApplicationProxy.java:1938)
    at excel.Application.getDefaultFilePath(Application.java:2237)

  • SocketException error.

    From time to time one of our JSP pages is throwing this error
              Wed Aug 30 13:56:45 GMT 2000:<E> <ServletContext-General> exception raised
              on '/
              Login.jsp'
              java.net.SocketException: Connection reset by peer: socket write error
              at java.net.SocketOutputStream.socketWrite(Native Method)
              at java.net.SocketOutputStream.write(SocketOutputStream.java,
              Compiled C
              ode)
              at weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java,
              Com
              piled Code)
              It doesn't do it all the time and it doesn't seem to cause a probelm or have
              any effect on the output on our clients. Can someone tell me what this
              error is and what I can do about it?
              

    Typically, this means that the browser connection has gone away. This could
              happen if the user browses to another page or closes the browser before the
              server is done sending the current page.
              It's harmless.
              anders
              "Mike Salway" <[email protected]> wrote in message
              news:[email protected]..
              > From time to time one of our JSP pages is throwing this error
              >
              >
              > Wed Aug 30 13:56:45 GMT 2000:<E> <ServletContext-General> exception raised
              > on '/
              > Login.jsp'
              > java.net.SocketException: Connection reset by peer: socket write error
              > at java.net.SocketOutputStream.socketWrite(Native Method)
              > at java.net.SocketOutputStream.write(SocketOutputStream.java,
              > Compiled C
              > ode)
              > at
              weblogic.servlet.internal.ChunkUtils.writeChunks(ChunkUtils.java,
              > Com
              > piled Code)
              >
              >
              > It doesn't do it all the time and it doesn't seem to cause a probelm or
              have
              > any effect on the output on our clients. Can someone tell me what this
              > error is and what I can do about it?
              >
              >
              

  • SocketException BEA-101083 Weblogic 9.2

    Hi,
    we are facing a problem in our production environment, we get pratically every minutes the following exception :
    <30 juin 2008 10 h 27 CEST> <Error> <HTTP> <BEA-101083> <Connection failure.
    java.net.SocketException: Error in poll for fd=287, revents=32
         at weblogic.socket.PosixSocketMuxer.processSockets(PosixSocketMuxer.java:133)
         at weblogic.socket.SocketReaderRequest.run(SocketReaderRequest.java:29)
         at weblogic.socket.SocketReaderRequest.execute(SocketReaderRequest.java:42)
         at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:145)
         at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:117)
    >
    What can be the cause of this ? Our users are telling us that the application goes very slow and this is the only abnormal log that we found.
    Thank you,
    Quentin Anciaux
    <[email protected]>

    Hi, the problem happens pratically once or two per minute while the application is in use... when the application is not used, no error happens.
    So it happens very often... I thought it could be a problem with a proxy/firewall in the middle, but according to the guys in charge of this, nothing has changed on his side.
    I've read things about a possible bug in the nativeIO implementation, would it be safe to deactivate nativeIO to see if this bug arise with pure java socket ?
    Also this problem only occurs in our production environment, we have 4 others environment used for testing/training/integration and this error does not occur there.
    Thanks for any help,
    Quentin Anciaux

  • How to avoid a SocketException: Connection reset by peer

    Hi,
    My problem sounds very simple at first, but I couldn't figure out how to get out of it. It's tricky.
    A have a JSP page which makes some processing and yields output to the user. Everything runs OK, until the user decide to stop the window (or to close the window) before the results render to the browser. When the next browser tries to load this page, the right page is loaded, but before it, the error garbage (error page, stack trace) from the previous user is showed in the browser...the exception is SocketException: Connection Reset by Peer.
    As I could see in the error log for the web server, the server flushes the page to the client browser, but the browser closed the HTTP connection, then this error is returned. That's OK, but this error output that was not sent appears to be "stored" somewhere in the server, and then is sent to the next client that requests the page. I tried to clear the buffer with out.clearBuffer() in the beginning of the page, but it didn't work.
    The solution would simply be to ignore this error output, i.e., to clean the output before the next user try to load the page. but I don't know how to do that.
    Sorry about the long posting, I hope I was clear in my explanation. I am using Websphere Studio Testing Web Server...and this situation happens on any browser (the problem seems to be in the server).
    Thanks in advance,
    Tiago.

    try using out.flush() in your code, use finalize ??
    out.flush();
    out.close();
    all the best !

  • About jdbc and networking

    hi, i found this error while im generating a report
    for my system, "Aging of Accounts Receivables"
    hope someone might give me a hint to what should i do.
    here's my StackTrace:
    ***Exception:
    org.postgresql.util.PSQLException: The connection attempt failed because Exception: java.net.BindException: Address already in use: connect
    Stack Trace:
    java.net.BindException: Address already in use: 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:179)
    at org.postgresql.core.PGStream.<init>(PGStream.java:47)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:197)
    at org.postgresql.Driver.connect(Driver.java:139)
    org.postgresql.util.PSQLException: The connection attempt failed because Exception: java.net.BindException: Address already in use: connect
    Stack Trace:
    java.net.BindException: Address already in use: 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:179)
    at org.postgresql.core.PGStream.<init>(PGStream.java:47)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:197)
    at org.postgresql.Driver.connect(Driver.java:139)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at org.postgresql.jdbc2.optional.BaseDataSource.getConnection(BaseDataSource.java:72)
    at org.postgresql.jdbc2.optional.BaseDataSource.getConnection(BaseDataSource.java:55)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at org.postgresql.jdbc2.optional.BaseDataSource.getConnection(BaseDataSource.java:72)
    at org.postgresql.jdbc2.optional.BaseDataSource.getConnection(BaseDataSource.java:55)
    at org.postgresql.jdbc3.Jdbc3ConnectionPool.getPooledConnection(Jdbc3ConnectionPool.java:39)
    at org.postgresql.jdbc3.Jdbc3ConnectionPool.getPooledConnection(Jdbc3ConnectionPool.java:39)
    at org.postgresql.jdbc2.optional.PoolingDataSource.getPooledConnection(PoolingDataSource.java:406)
    at org.postgresql.jdbc2.optional.PoolingDataSource.getConnection(PoolingDataSource.java:338)
    at csfwdbillingmodules.dbConnect.<init>(dbConnect.java:73)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.processAccountAR(frmAgingOfAccounts.java:794)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.genDetailedReport(frmAgingOfAccounts.java:1102)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.doInBackground(frmAgingOfAccounts.java:406)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.doInBackground(frmAgingOfAccounts.java:400)
    at javax.swing.SwingWorker$1.call(SwingWorker.java:279)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at javax.swing.SwingWorker.run(SwingWorker.java:319)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    End of Stack Trace
    at org.postgresql.jdbc2.optional.PoolingDataSource.getPooledConnection(PoolingDataSource.java:406)
    at org.postgresql.jdbc2.optional.PoolingDataSource.getConnection(PoolingDataSource.java:338)
    at csfwdbillingmodules.dbConnect.<init>(dbConnect.java:73)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.processAccountAR(frmAgingOfAccounts.java:794)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.genDetailedReport(frmAgingOfAccounts.java:1102)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.doInBackground(frmAgingOfAccounts.java:406)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.doInBackground(frmAgingOfAccounts.java:400)
    at javax.swing.SwingWorker$1.call(SwingWorker.java:279)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at org.postgresql.jdbc1.AbstractJdbc1Connection.openConnection(AbstractJdbc1Connection.java:208)
    at org.postgresql.Driver.connect(Driver.java:139)
    at java.sql.DriverManager.getConnection(DriverManager.java:582)
    at java.sql.DriverManager.getConnection(DriverManager.java:185)
    at org.postgresql.jdbc2.optional.BaseDataSource.getConnection(BaseDataSource.java:72)
    at org.postgresql.jdbc2.optional.BaseDataSource.getConnection(BaseDataSource.java:55)
    at org.postgresql.jdbc3.Jdbc3ConnectionPool.getPooledConnection(Jdbc3ConnectionPool.java:39)
    at org.postgresql.jdbc2.optional.PoolingDataSource.getPooledConnection(PoolingDataSource.java:406)
    at org.postgresql.jdbc2.optional.PoolingDataSource.getConnection(PoolingDataSource.java:338)
    at csfwdbillingmodules.dbConnect.<init>(dbConnect.java:73)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.processAccountAR(frmAgingOfAccounts.java:794)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.genDetailedReport(frmAgingOfAccounts.java:1102)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.doInBackground(frmAgingOfAccounts.java:406)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.doInBackground(frmAgingOfAccounts.java:400)
    at javax.swing.SwingWorker$1.call(SwingWorker.java:279)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at javax.swing.SwingWorker.run(SwingWorker.java:319)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    java.lang.NullPointerException
    at csfwdbillingmodules.dbConnect.query(dbConnect.java:96)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.processAccountAR(frmAgingOfAccounts.java:798)
    at csfwdbillingmodules.frmAgingOfAccounts$genAgingOfAccounts.genDetailedReport(frmAgingOfAccounts.java:1102)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at javax.swing.SwingWorker.run(SwingWorker.java:319)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
    at java.lang.Thread.run(Thread.java:619)
    End of Stack Trace
    here's my dbConnect.class:
    * dbConnect.java
    * Created on November 14, 2006, 5:06 PM
    * To change this template, choose Tools | Template Manager
    * and open the template in the editor.
    * @author darkoasis
    package csfwdbillingmodules;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.net.InetAddress;
    import java.net.ServerSocket;
    import java.net.Socket;
    import java.net.SocketAddress;
    import java.net.SocketException;
    import java.net.SocketImpl;
    import java.sql.*; // All we need for JDBC
    import javax.naming.NamingException;
    import org.postgresql.jdbc3.Jdbc3PoolingDataSource;
    public class dbConnect
    extends java.lang.Object
    private Socket socket;
    private SocketImpl socketImpl;
    private int refPosition = 0;
    private Jdbc3PoolingDataSource source = new Jdbc3PoolingDataSource();
    private DriverManager drvMgr;
    private Connection db = null; // A connection to the database
    private Statement sql; // Our statement to run queries with
    private ResultSet results; // A result container
    private DatabaseMetaData dbmd; // This is basically info the driver delivers
    // about the DB it just connected to. I use
    // it to get the DB version to confirm the
    // connection in this example.
    /** Creates a new instance of dbConnect */
    public dbConnect()
    try
    this.source.setServerName("10.10.10.10");
    this.source.setDatabaseName("myDB");
    this.source.setUser("xxxx");
    this.source.setPassword("xxxx");
    this.db = this.source.getConnection();
    this.socket = new Socket();
    dbmd = this.db.getMetaData(); //get MetaData to confirm connection
    sql = this.db.createStatement(); //create a statement that we can use later
    catch (Exception ex)
    System.out.println("***Exception:\n"+ex);
    ex.printStackTrace();
    public ResultSet query(String strSQL)
    throws SQLException
    this.results = this.sql.executeQuery(strSQL);
    return this.results;
    public void update(String strSQL)
    throws SQLException
    this.sql.executeUpdate(strSQL);
    public void close()
    throws Exception
    this.db.close();
    this.socket.close();
    this.source.close();
    public boolean isClosed()
    throws SQLException
    return this.db.isClosed();
    i ran into some forums and found this:
    Hi Graham
    I'm making a bit of progress. I found a website that suggested the following
    This is a problem of the used sockets with Windows NT. You can request the active sockets with the command netstat. The problem is a function of:
    MaxUserPort (default 5000)
    KeepAliveTime (default 120)
    it suggested the workaround was connection pooling
    I have run netstat to look at the number of connections when the problem occurs and waited for the timeout to reset the os back to the minimum and on each occasion my report has run
    Does this sound logical?
    If so
    do you have any examples on connection pooling
    it seems that even if i have closed my database connection it still doesn't free my port that was used, that's why i get this error
    i am looking for a way to close my db connection and free its socket or port used at the same time, hope you can help,
    thanks in advance

    Let me modestly point you at mine: http://www.telekinesis.com.au/wipv3_6/FundamentalNetworkingInJava.A21

  • Why I always encounter SocketException in weblogic6.1sp2?

    when I use weblogic6.1sp2 to develop my j2ee B/S program,I find the weblogic server
    alway throw follow exception,
    java.net.SocketException: ReadFile failed: &#25351;&#23450;&#30340;&#32593;&#32476;&#21517;&#19981;&#20877;&#21487;&#29992;&#12290;
    (error 64, fd 2348)
    at weblogic.socket.NTSocketMuxer.initiateIO(Native Method)
    at weblogic.socket.NTSocketMuxer.read(NTSocketMuxer.java:410)
    at weblogic.servlet.internal.MuxableSocketHTTP.requeue(MuxableSocketHTTP
    .java:222)
    at weblogic.servlet.internal.ServletResponseImpl.send(ServletResponseImp
    l.java:992)
    at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
    pl.java:2209)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:139)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:120)
    >
    but the result is browser is right.Is my program has some bug or may be the config
    of the weblogic server is wrong?

    Hello kmschmehl-
    I cannot truly express how sorry I am to hear about your total experience with the delivery and subsequent return of this fridge.  It certainly sounds as though Best Buy has put you through the ringer and I can absolutely understand your disappointment and anger with us.
    While it sounds like some aspects of the purchase and delivery were at least adequate, any opportunity that we had to show you why you should purchase from Best Buy went by the wayside.  However, Best Buy is not in the business to provide merely adequate experiences and I am saddened that this is the best we could summon for your purchase.  We are capable of better than what we showed you.
    I’m glad to hear that you have finally been able to get the assistance you needed to get this refund resolved and make you whole again.  In addition, I do hope that you are enjoying the fridge you purchased at Lowe’s.  I certainly wish that it had been a Best Buy fridge in your kitchen instead, but I can understand why you chose to go with another retailer.
    It sounds like the store has you in good hands once your card arrives and I believe that the reason they need the physical card is that the credit card company requires it to be physically scanned for returns.  Hopefully you will not run into any further issues with this refund and it’s my hope that sometime in the future, you might grant us another chance at your business.  I will be sending you a Private Message with some additional details as well.  To check your Private Messages, please log into the forum and click on the envelope in the upper right hand corner.
    Please let us know if you run into any further concerns.
    Sincerely,
    Bill|Senior Social Media Specialist | Best Buy® Corporate
     Private Message

  • SocketException with errno 0x31

    Hello !!!
    Can anyone tell me the meaning of this errno or tell me a link where I can find out more about such error-numbers
    java.net.SocketException: errno = 0x31
    at java.net.PlainSocketImpl.doConnect()
    at java.net.PlainSocketImpl.connectToAddress()
    at java.net.PlainSocketImpl.connect()
    at java.net.Socket.<init>()
    at java.net.Socket.<init>()

    What platform are you running on? On Unix you can usually do a man intro to get these codes or check errno.h.

  • Managedavailability error about inbound proxy probe failing

    getting a managedavailability error about inbound proxy probe failing.
    what does the inbound proxy probe do, and why does this error reference forefront, when I do not have MS forefront installed?
    below are the details:
    The inbound proxy probe failed 3 times over 15 minutes.
    The inbound proxy probe failed 3 times over 15 minutes. No connection could be made because the target machine actively refused it 127.0.0.1:25 Probe Exception: 'System.Net.Sockets.SocketException (0x80004005): No connection could be made because the target
    machine actively refused it 127.0.0.1:25 at System.Net.Sockets.TcpClient..ctor(String hostname, Int32 port) at Microsoft.Forefront.Monitoring.ActiveMonitoring.Smtp.Probes.SimpleSmtpClient.Connect(String server, Int32 port, Boolean disconnectIfConnected) at
    Microsoft.Forefront.Monitoring.ActiveMonitoring.Smtp.Probes.SmtpConnectionProbe.MeasureLatency(String reason, ActionWithReturn`1 cmd) at Microsoft.Forefront.Monitoring.ActiveMonitoring.Smtp.Probes.SmtpConnectionProbe.MeasureLatency(String reason, ActionWithReturn`1
    cmd, ConnectionLostPoint connectionLostPoint) at Microsoft.Forefront.Monitoring.ActiveMonitoring.Smtp.Probes.SmtpConnectionProbe.TestConnection() at Microsoft.Forefront.Monitoring.ActiveMonitoring.Smtp.Probes.SmtpConnectionProbe.DoWork(CancellationToken cancellationToken)
    at Microsoft.Office.Datacenter.WorkerTaskFramework.WorkItem.Execute(CancellationToken joinedToken) at Microsoft.Office.Datacenter.WorkerTaskFramework.WorkItem.<>c__DisplayClass2.b__0() at System.Threading.Tasks.Task.Execute()' Failure Context: 'No connection
    could be made because the target machine actively refused it 127.0.0.1:25' Execution Context: '' Probe Result Name: 'OnPremisesInboundProxy' Probe Result Type: 'Failed' Monitor Total Value: '3' Monitor Total Sample Count: '3' Monitor Total Failed Count: '0'
    Monitor Poisoned Count: '0' Monitor First Alert Observed Time: '1/27/2015 4:46:45 PM

    Hi,
    Please use the Get-ServerHealth and Get-HealthReport commands to check result.
    Here is a related blog for your reference.
    http://blogs.technet.com/b/exchange/archive/2013/06/26/managed-availability-and-server-health.aspx
    Best regards,
    Belinda Ma
    TechNet Community Support

  • SocketException: permission denied: connect

    Thanks in advance for your help, I am determined to find out why Java applets won't run in IE 7 but will run in FF on this one PC!
    I have done all the complete Java uninstall/reinstall directions
    I have turned off spyware checking, firewall, antivirus software
    Frankly I doubt it is that, as FF runs fine.
    When I run one of the test applets on the Internet, JRE comes up in the system tray, the Java logo appears in the applet box, then it says error. When I check the error console, it says:
    java.lang.ClassNotFoundException: JavaVersionDisplayApplet.class
    caused by:
    java.net.SocketException: Permission denied: connect
    Java is configured to use browser settings, IE automatically detects settings. It sure seems something is preventing the socket connect.
    How can I find out what is causing this?

    Don0819 wrote:
    Thanks, but these links seem to all discuss issues with code you have written having proper permissions, certificates, etc. I have installed JRE on a computer, run IE, and get this error.The name of these forums is "Developer Forums" - it is expectable that an answer assumes
    you have problems with something you are developing.
    Don0819 wrote:
    ... why Java applets won't run in IE 7 but will run in FF on this one PC!Are you sure IE uses the Sun JVM and not the old and deprecated MS JVM?
    [Is this an older Windows? - Before MS stopped pushing their own JVM]
    Is this what is necessary to get Java working in a browser? There are 100s of links talking about applet security, none of it seemed to be relevant to my problem although I may have missed something....Assuming you do not have any user policy files;
    does the system policy file java.home\lib\security\java.policy
    say anything about SocketPermissions?

  • How to send message to Client about Server shutdown.

    I have made a Chatting Application using RMI.
    I need to send messages to all the Clients when a Server shutdowns abnormally.
    One way is that I use shutdown hook on the Server Application.
    But, what if the power of the machine on which server is running goes off. How will the Client get to know that server is down.
    I also want that If a Client shutdowns abnormally,it should send the message to the Server which in turn will send message to other Clients about the particular Client.
    Thanks & Regards.
    Nimesh

    Before you make any call form client to server check that sever is available. This is easily done by intorudciing an rmi method that will return true e.g m_sever.isAvalable(); if server is availbel you will get ture if not then you will get an RMI Excpetion which you then trap and attemp to reconnect to the server (NAming.lookup() ) .. if several attempts fail then assume server is down.
    When a client dies it throws an excpetion on the sErver :
    java.net.SocketException: Connection reset by peer: JVM_recv in socket input stream read
         at java.net.SocketInputStream.socketRead0(Native Method)
         at java.net.SocketInputStream.read(SocketInputStream.java:116)
         at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
         at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
         at java.io.FilterInputStream.read(FilterInputStream.java:66)
         at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:442)
         at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
         at java.lang.Thread.run(Thread.java:536)
    trap this and deal with it appropriatly.
    hope this helps.
    Charbel.

  • (Linux) SocketException: Connection reset

    I get a nasty exception while reading on a socket.
    SocketException: Connection reset
    The exception occurrs when running on Linux Redhat 8.0. I can't reproduce it when running on Windows. Could anyone explain why it happen.
    I'm using sdk 1.4.0_01.
    public class Test {
    void transfer() throws IOException {
    Socket socket = null;
    try {
    //Open a socket connection to server
    socket = new Socket("127.0.0.1",4321);
    //Enable SO_TIMEOUT with the specified timeout
    socket.setSoTimeout(60000);
    //Create channels
    ReadableByteChannel readableChannel = Channels.newChannel(socket.getInputStream());
    WritableByteChannel writableChannel = Channels.newChannel(socket.getOutputStream());
    //Create and fill buffer
    ByteBuffer buffer = ByteBuffer.allocate(32);
    while(buffer.hasRemaining())
    buffer.put((byte)1);
    buffer.flip();
    //Send
    while(buffer.hasRemaining()) {
    //Write message
    writableChannel.write(buffer);
    //Clear buffer
    buffer.clear();
    try {
    readableChannel.read(buffer);
    } catch(SocketException se) {
    System.err.println(se.getMessage());
    catch(IOException ioe) {
    finally {
    try {
    if(socket != null)
    socket.close();
    }catch(IOException ioe) {}
    Output:
    SocketException: Connection reset

    No, I actually can't. It's written by a third party in C, and I can't get the source.
    The thing is that I want to keep my connection open for several transfers, and when running on Linux suddenly my connection goes down. Sometimes it takes 20 min (about 100 transfers) and sometimes just after a few minutes (about 10 transfers). I haven't seen the problem when running on Windows.
    There were some mistakes in my code above. I hope I correct them here.
    I'm using sdk 1.4.1_01 and NOT 1.4.0_x.
    public class Test {
    private Socket socket = null;
    private ReadableByteChannel readableChannel;
    private WritableByteChannel writableChannel;
    public Test() throws IOException {
    //Open a socket connection to server
    socket = new Socket("127.0.0.1",4321);
    //Enable SO_TIMEOUT with the specified timeout
    socket.setSoTimeout(60000);
    //Create channels
    readableChannel = Channels.newChannel(socket.getInputStream());
    writableChannel = Channels.newChannel(socket.getOutputStream());
    void transfer() throws IOException {
    try {
    //Create and fill buffer
    ByteBuffer buffer = ByteBuffer.allocate(32);
    while(buffer.hasRemaining())
    buffer.put((byte)1);
    buffer.flip();
    //Send
    while(buffer.hasRemaining()) {
    //Write message
    writableChannel.write(buffer);
    //Clear buffer
    buffer.clear();
    try {
    readableChannel.read(buffer);
    } catch(SocketException se) {
    System.err.println("Nasty exception: "+se.getMessage());
    catch(IOException ioe) {
    System.out.println("This never happen");
    public void close() {
    try {
    if(socket != null)
    socket.close();
    }catch(IOException ioe) {}
    Output:
    Nasty exception: SocketException: Connection reset

Maybe you are looking for

  • How to search a text in text area?

    Hi All, I want to search a text in the text area and it should be like searching by the Find Dialog Box with upward direction or downward direction with case sensitive option. I know searching text in a file. But I dont know how to search in the abov

  • Trying to create object of a class within servlet - help!!

    I have created and compiled the following classes within C:\bea\wlserver6.1\config\mydomain\applications\DefaultWebApp\WEB-INF\classes 1)LoginServlet 2)LoginManager 3)I have LoginServlet trying to create an object of type LoginManager, very simple, b

  • Can we enable "Select record Set Message choice" of Table in left side

    Hi , I have requirement to set the "Select Record Set " Message choice of a table region on left side. Ex:If there are more records in a table region and message choice available to select next set of records. You can chk in Workflow Status Monitor f

  • GR unit value coming from the Invoice

    I have the following situation: PO 100 units price 3,14 u20AC/unit IR: 1 unit at a price of 314 u20AC/unit GR: Post GR for 100 units and the system is generating the accounting doc. for a value of 624,86 u20AC, that comes from - 1 unit at the price o

  • Calculating Round Trip Time from Non-Spatial Log Data

    Hi, I have a log table which holds the vehicles' "entrance" an "exit" dates (dd.mm.yyyy) to/from regions like that: VEHICLE_ID REGION IN_TIME OUT_TIME 1001 CUST_A 01.01.2007 03.01.2007 1001 CUST_B 05.01.2007 06.01.2007 1002 CUST_C 04.01.2007 06.01.20