friday
friday

Reputation: 1498

Android Spring Jackson Mapping: NoClassDefFoundError

i'm trying to let my android application function as a REST Client. Basically i followed this example: https://github.com/SpringSource/spring-android-samples/tree/master/spring-android-basic-auth/client/src/org/springframework/android/basicauth .

I am developing for Android 2.3 and above. I added

spring-android-rest-template-1.0.0.RELEASE.jar
spring-android-auth-1.0.0.RELEASE.jar
spring-android-core-1.0.0.RELEASE.jar and
jackson-mini-1.9.11.jar 

to my buildpath.

Anyway I always get these errors

11-26 19:01:24.461: E/dalvikvm(15994): Could not find class 'org.codehaus.jackson.map.ObjectMapper', referenced from method org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.<init>
11-26 19:01:24.480: E/AndroidRuntime(15994): java.lang.RuntimeException: An error occured while executing doInBackground()
11-26 19:01:24.480: E/AndroidRuntime(15994): Caused by: java.lang.NoClassDefFoundError: org.codehaus.jackson.map.ObjectMapper

in the second line of this code:

RestTemplate restTemplate = new RestTemplate();
restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());

Can anybody help me out here?

Iris

Upvotes: 3

Views: 6344

Answers (2)

friday
friday

Reputation: 1498

The solution to the problem was (as Selvin stated in his comment) to include the full jackson instead of the jackson mini library. Thanks again Selvin.

Upvotes: 2

Ahmad
Ahmad

Reputation: 72613

If you get NoClassDefFoundError during Runtime, then I suspect you did not include the .jar files to work at runtime. You have to check the checkbox for each .jar like this:

enter image description here

Upvotes: 5

Related Questions