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
MellycooksMellycooks 

JSON exception in BulkConnection.getBatchResult

I'm working with the Bulk API, using the WSC to query records from Salesforce.  When I submit the getBatchResult request to BulkConnection and pass in the optional ContentType.JSON parameter, i get an error that seems to indicate a JSON Parsing error.  I know JSON support for this is new this release, perhaps a bug?  If I set the job Content Type as JSON, I have to use it consistently.

Details:  Query against the Contact Object,  Job executes fine, but cannot get BatchResult with JSON.  Here is the exception from the terminal:

Key line from log: Caused by: org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class com.sforce.async.Result] from JSON String; no single-String constructor/factory method

Full Exception Message:
[AsyncApiException  exceptionCode='ClientInputError'
 exceptionMessage='Failed to get result '
]

at com.sforce.async.BulkConnection.getBatchResult(BulkConnection.java:600)
at SObjectSynch.bulkFetch(SObjectSynch.java:261)
at CacheSynch$4.onMessage(CacheSynch.java:175)
at org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyOnMessage(AbstractClientSession.java:394)
at org.cometd.common.AbstractClientSession$AbstractSessionChannel.notifyMessageListeners(AbstractClientSession.java:385)
at org.cometd.common.AbstractClientSession.receive(AbstractClientSession.java:225)
at org.cometd.client.BayeuxClient.processMessage(BayeuxClient.java:736)
at org.cometd.client.BayeuxClient$PublishTransportListener.processMessage(BayeuxClient.java:1111)
at org.cometd.client.BayeuxClient$ConnectTransportListener.processMessage(BayeuxClient.java:1166)
at org.cometd.client.BayeuxClient$PublishTransportListener.onMessages(BayeuxClient.java:1086)
at org.cometd.client.transport.LongPollingTransport$TransportExchange.onResponseComplete(LongPollingTransport.java:297)
at org.eclipse.jetty.client.HttpExchange$Listener.onResponseComplete(HttpExchange.java:968)
at org.eclipse.jetty.client.HttpExchange.setStatus(HttpExchange.java:279)
at org.eclipse.jetty.client.HttpConnection$Handler.messageComplete(HttpConnection.java:619)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:862)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:214)
at org.eclipse.jetty.client.HttpConnection.handle(HttpConnection.java:275)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:535)
at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:529)
at java.lang.Thread.run(Thread.java:745)
Caused by: org.codehaus.jackson.map.JsonMappingException: Can not instantiate value of type [simple type, class com.sforce.async.Result] from JSON String; no single-String constructor/factory method
at org.codehaus.jackson.map.deser.std.StdValueInstantiator._createFromStringFallbacks(StdValueInstantiator.java:379)
at org.codehaus.jackson.map.deser.std.StdValueInstantiator.createFromString(StdValueInstantiator.java:268)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromString(BeanDeserializer.java:765)
at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:585)
at org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:104)
at org.codehaus.jackson.map.deser.std.ObjectArrayDeserializer.deserialize(ObjectArrayDeserializer.java:18)
at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2732)
at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1909)
at com.sforce.async.BulkConnection.deserializeJsonToObject(BulkConnection.java:806)
at com.sforce.async.BulkConnection.getBatchResult(BulkConnection.java:587)
... 20 more