function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venk_ModelMetriVenk_ModelMetri 

java.net.SocketTimeoutException with Axis - Read Timed out.

Hi,

I'm trying to query tasks (just one simple select statement) and I get this error below.

Source:

  private void getTasks() {

      final Double UNO = new Double(1.0);

      //check to see if we are already logged in
      if (lr == null) {
        System.out.println("Run the login sample before the others.\n");
        getUserInput("Hit enter to continue: ");
        System.out.println("\n");
        return;
      }

      //create a variable to hold the query result
      QueryResult qr = null;

      //TO SELECT THE OPPORTUNITY MODIFIED TODAY
      QueryResult qr1 = null;

      // Call the query saving the results in qr
      String sqlquery =
          "select whatId, time25Increments__c, billable_Status__c from Task "

          + " where billable_Status__c='Billable'";
      try {
        qr = binding.query(sqlquery);
      }
      catch (UnexpectedErrorFault uef) {
        System.out.println(uef.getExceptionMessage() + "\n\n");
        return;
      }
      catch (Exception e) {
        e.printStackTrace();
        System.out.println("\n\n");
        return;
      }

      if (qr != null) {
      SObject[] records = qr.getRecords();
      System.out.println( "THE LENGTH RETURNED IS = " + records.length);
      //we can loop through the returned records
      for (int i = 0; i < records.length; i++) {
        //Because we asked for accounts we will convert
        //the SObject for each record into an Account object
        Task task = (Task) records[i];

        //Now we can access any of the fields we had in the query
        //select clause directly from the account variable
        System.out.print(new Integer(i).toString() + ". ");
        System.out.print("WHAT ID "+ task.getWhatId() + " - ");
        System.out.print("time25Increments__c "+ task.getTime25Increments__c() + " - ");
        System.out.print("getBillable_Status__c "+ task.getBillable_Status__c() + " - ");
      }
      System.out.println("");
    }

 

AxisFault
 faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server.userException
 faultSubcode:
 faultString: java.net.SocketTimeoutException: Read timed out
 faultActor:
 faultNode:
 faultDetail:
        {http://xml.apache.org/axis/}stackTrace: java.net.SocketTimeoutException Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at com.sun.net.ssl.internal.ssl.InputRecord.a(DashoA6275)
        at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA6275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
        at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA6275)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
        at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPS
ender.java:506)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:127)

        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
        at org.apache.axis.client.Call.invoke(Call.java:2553)
        at org.apache.axis.client.Call.invoke(Call.java:2248)
        at org.apache.axis.client.Call.invoke(Call.java:2171)
        at org.apache.axis.client.Call.invoke(Call.java:1691)
        at com.sforce.soap.enterprise.SoapBindingStub.query(SoapBindingStub.java1386)
        at com.salesforce.quickstart.products.getTasks(products.java:589)
        at com.salesforce.quickstart.products.&lt;init&gt;(products.java:77)
        at com.salesforce.quickstart.products.main(products.java:55)

java.net.SocketTimeoutException: Read timed out
        at org.apache.axis.AxisFault.makeFault(AxisFault.java:129)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:131)
        at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrateg
y.java:71)
        at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:150)
        at org.apache.axis.SimpleChain.invoke(SimpleChain.java:120)
        at org.apache.axis.client.AxisClient.invoke(AxisClient.java:180)
        at org.apache.axis.client.Call.invokeEngine(Call.java:2564)
        at org.apache.axis.client.Call.invoke(Call.java:2553)
        at org.apache.axis.client.Call.invoke(Call.java:2248)
        at org.apache.axis.client.Call.invoke(Call.java:2171)
        at org.apache.axis.client.Call.invoke(Call.java:1691)
        at com.sforce.soap.enterprise.SoapBindingStub.query(SoapBindingStub.java1386)
        at com.salesforce.quickstart.products.getTasks(products.java:589)
        at com.salesforce.quickstart.products.<init>(products.java:77)
        at com.salesforce.quickstart.products.main(products.java:55)
Caused by: java.net.SocketTimeoutException: Read timed out
        at java.net.SocketInputStream.socketRead0(Native Method)
        at java.net.SocketInputStream.read(SocketInputStream.java:129)
        at com.sun.net.ssl.internal.ssl.InputRecord.a(DashoA6275)
        at com.sun.net.ssl.internal.ssl.InputRecord.read(DashoA6275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
        at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275)
        at com.sun.net.ssl.internal.ssl.AppInputStream.read(DashoA6275)
        at java.io.BufferedInputStream.fill(BufferedInputStream.java:183)
        at java.io.BufferedInputStream.read(BufferedInputStream.java:201)
        at org.apache.axis.transport.http.HTTPSender.readHeadersFromSocket(HTTPS
ender.java:506)
        at org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:127)
        ... 13 more
 
 
adamgadamg
This looks like network issue, and should be unrelated to your code - does this always happen, or only sometimes?
zakzak
Axis has a default timeout of 60 seconds, you might need to bump it up to something highter. (use the setTimeout method on the binding stub)
Venk_ModelMetriVenk_ModelMetri

It happens occasionally. (I've noticed that the first 2-3 attempts to run the program give this error and after that its fine.) The query takes a while to execute and times out. I've used this in 2- 3 different network (work network, home  and a friend's work network) it happens.

 

Is there a way for me to bump up the timeout limit?

adamgadamg
If you look at the Java samples you'll find a reference to setting the timeout value.

I still find it odd that you are getting such consistantly bad results - can you post details/code of the actual opertation you are performing?
Venk_ModelMetriVenk_ModelMetri

The query is simple

 

// Call the query saving the results in qr
      String sqlquery =
          "select whatId, time25Increments__c, billable_Status__c from Task "

          + " where billable_Status__c='Billable'";
      try {
        qr = binding.query(sqlquery);  (Fails here)
      }
 

 

(the whole code is in my first post)

BlandgerBlandger
Try to increase BatchSize.
It's helped to me. I used 200.