I've been developing recently on an app that uses Spring Social to connect to Facebook, and up until sometime yesterday it had been going pretty well. Then suddenly the call started failing, for no reason that I could see, and connected to no change of mine that I could isolate.
Eventually I boiled it down to the simplest case I could--stripping away everything else--and reduced it to the following code...
...which still fails with the following error message:Code:package com.testproject; import java.util.List; import org.springframework.social.facebook.api.Facebook; import org.springframework.social.facebook.api.Page; import org.springframework.social.facebook.api.impl.FacebookTemplate; public class FacebookTest { public static void main(String[] args) { Facebook facebook = new FacebookTemplate("<authtoken pasted here>"); List<Page> musicLikes = facebook.likeOperations().getMusic(); for (Page p : musicLikes) { System.out.println(p.getName()); } } }
Stepping through the code, I found that the app did seem to be successfully connecting to Facebook and retrieving the response, with what appeared to be the data of the test Facebook account as I would expect. It was only when Spring Social went to deserialize it that it hit problems.Code:Exception in thread "main" org.springframework.social.UncategorizedApiException: Error deserializing data from Facebook: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: N/A; line: -1, column: -1] at org.springframework.social.facebook.api.impl.FacebookTemplate.deserializeDataList(FacebookTemplate.java:272) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:186) at org.springframework.social.facebook.api.impl.FacebookTemplate.fetchConnections(FacebookTemplate.java:179) at org.springframework.social.facebook.api.impl.LikeTemplate.getMusic(LikeTemplate.java:83) at org.springframework.social.facebook.api.impl.LikeTemplate.getMusic(LikeTemplate.java:78) at com.testproject.FacebookTest.main(FacebookTest.java:12) Caused by: org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_OBJECT token at [Source: N/A; line: -1, column: -1] at org.codehaus.jackson.map.JsonMappingException.from(JsonMappingException.java:163) at org.codehaus.jackson.map.deser.StdDeserializationContext.mappingException(StdDeserializationContext.java:219) at org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:44) at org.codehaus.jackson.map.deser.std.StringDeserializer.deserialize(StringDeserializer.java:13) at org.codehaus.jackson.map.deser.SettableBeanProperty.deserialize(SettableBeanProperty.java:299) at org.codehaus.jackson.map.deser.BeanDeserializer._deserializeUsingPropertyBased(BeanDeserializer.java:924) at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObjectUsingNonDefault(BeanDeserializer.java:733) at org.codehaus.jackson.map.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:683) at org.codehaus.jackson.map.deser.BeanDeserializer.deserialize(BeanDeserializer.java:580) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:217) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:194) at org.codehaus.jackson.map.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:30) at org.codehaus.jackson.map.ObjectMapper._readValue(ObjectMapper.java:2695) at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:2022) at org.springframework.social.facebook.api.impl.FacebookTemplate.deserializeDataList(FacebookTemplate.java:270) ... 5 more
As I mentioned above, this was working just dandy for me up until yesterday, which makes me rather suspect that something changed outside my code, but given that I'm rather a novice in this area I wanted to ask first to see if there was anything stupid I was doing that would result in this issue. Is anyone else seeing this problem? Is there a way known to resolve it, or a fix coming?
Thanks much for any pointers.


Reply With Quote