B4J Question RDC Connection Refused

Discussion in 'B4J Questions' started by johnB, Jul 7, 2015.

  1. johnB

    johnB Active Member Licensed User

    Hi
    Can anybody advise how to catch this error in B4J. In B4A I catch it in JobDone but in B4J it doesn't seem to go to JobDone if the connection isn't made.

    If the connection is down I can change it to a second address which is what I do in B4A

    [/CODE]Return Get Non Trading Days
    org.apache.http.conn.HttpHostConnectException: Connection to http://johnbxxxxx.net:17178 refused
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:159)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:149)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:108)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:415)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:641)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:576)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:554)
    at anywheresoftware.b4a.http.HttpClientWrapper.executeWithTimeout(HttpClientWrapper.java:310)
    at anywheresoftware.b4a.http.HttpClientWrapper.access$0(HttpClientWrapper.java:308)
    at anywheresoftware.b4a.http.HttpClientWrapper$ExecuteHelper.run(HttpClientWrapper.java:207)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:745)
    Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
    at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
    at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:579)
    at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:123)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:133)
    ... 14 more
    Error: org.apache.http.conn.HttpHostConnectException: Connection to http://johnbxxxx.net:17178 refused
    [/CODE]

    Thanks
     
    Last edited: Jul 7, 2015
  2. johnB

    johnB Active Member Licensed User

    Sorry, found where it is trapped, it takes a long time to get there, I don't want to hold the program up for that long while I wait to see if the connection has been established. It doesn't take long in B4A. I would appreciate any suggestions?
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    Are you setting the request timeout? Job.GetRequest.Timeout
     
  4. johnB

    johnB Active Member Licensed User

    Ah so much to learn and so little time.

    Thanks Erel, NO, so I'll check it out, sure it will be the problem

    Regards
     
Loading...