You need to sign in to do that
Don't have an account?
kminev
[InvalidQueryLocatorFault [ApiFault exceptionCode='INVALID_QUERY_LOCATOR'
I have a java cron job which run twice a day and sometime I get the error message show on the subject.
It is strange because it could be running for days w/o this error and at some point out of the blue it would choke.
Below is my java code where I make the call to the force.com API and process the result from the queryResult object.
Any help will be appreciated, Thank you.
private static void getOpportunityInfo(){ try{ boolean done = false; QueryResult qr = connection.query(BASE_QUERY + " WHERE RecordTypeId = '" + MY_RECORD_TYPE_ID + "' AND (Opportunity__r.CloseDate >= 2010-01-01)"); if (qr.getRecords() != null && qr.getRecords().length > 0){ log.debug("QueryResults.getRecords().length: " + qr.getRecords().length); lineItems = new ArrayList<Opportunity_Line_Item__c>(); while (!done){ log.debug(" Processing next batch of opportunities..."); for (SObject sObj : qr.getRecords()) { try { Opportunity_Line_Item__c ol = (Opportunity_Line_Item__c)sObj; lineItems.add(ol); }catch(ClassCastException ex){ log.error("Exception while processing opportunity line items!, continue with next itteration...", ex); continue; } } if (qr.isDone()) { done = true; } else { qr = connection.queryMore(qr.getQueryLocator()); } } log.debug("Opportunity Line Items size: " + lineItems.size()); } }catch(Exception e){ log.error("Exception: ", e); } }
Also here is the error stack trace:
[InvalidQueryLocatorFault [ApiFault exceptionCode='INVALID_QUERY_LOCATOR'
exceptionMessage='invalid query locator'
]
]
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sforce.ws.bind.TypeMapper.readSingle(TypeMapper.java:627)
at com.sforce.ws.bind.TypeMapper.readObject(TypeMapper.java:504)
at com.sforce.ws.transport.SoapConnection.parseDetail(SoapConnection.java:229)
at com.sforce.ws.transport.SoapConnection.createException(SoapConnection.java:203)
at com.sforce.ws.transport.SoapConnection.receive(SoapConnection.java:149)
at com.sforce.ws.transport.SoapConnection.send(SoapConnection.java:98)
at com.sforce.soap.enterprise.EnterpriseConnection.queryMore(EnterpriseConnection.java:1)
at OpportunityExtractor.getOpportunityInfo(Unknown Source)
at OpportunityExtractor.main(Unknown Source)