Reputation: 21
I wrote a CGM server. There I used Jackson object mapper.( Not sure I used correct library: jackson-all-1.9) After running following exception occurred.
org.codehaus.jackson.map.JsonMappingException: No serializer found for class Content and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS) )
It says to disable SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS
.
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
Again compile time exception came.
SerializationFeature cannot be resolved to a variable.
How to solve this? I think i have used wrong library.
Upvotes: 1
Views: 2136
Reputation: 504
I had the same problem when I tried to use a good looking GCM server example found at http://hmkcode.com/android-google-cloud-messaging-tutorial/
Apart from changing the keys and IDs, the only thing I had to add to make it work is the following line in front of the "public class...
" line:
@JsonAutoDetect(fieldVisibility = Visibility.ANY)
I added this line in the Content.java
and the POST2GCM.java
file then it was all good to go! working fine!
Upvotes: -1