开发者

Ektorp NoClassDefFoundError: org.ektorp.impl.docref.DocumentReferenceSerializerProvider

I'm trying to use the Ektorp CouchDB library in an Android app and I always get this exception:

java.lang.NoClassDefFoundError: org.ektorp.impl.docref.DocumentReferenceSerializerProvider

Here is my code:

HttpClient authenticatedHttpClient = new StdHttpClient.Builder().host("myhostname").port(5984).username("username").password("password").build();
CouchDbInstance dbInstance = new StdCouchDbInstance(authe开发者_Go百科nticatedHttpClient);
CouchDbConnector db = dbInstance.createConnector("luscinia", true);

The exception always occurs on the last line of the above code.

I followed the erktop wiki about dependencies here: http://code.google.com/p/ektorp/wiki/dependencies

Which results in my project containing:

  • commons-io-2.0.1.jar
  • httpclient-4.1.1.jar
  • jackson-core-asl-1.8.1.jar
  • jackson-mapper-asl-1.8.1.jar
  • org.ektorp-1.1.1.jar
  • slf4j-api-1.6.1.jar
  • slf4j-simple-1.6.1.jar ( slf4j fails without it)

LogCat gives me a warning and an error lines before the exception, maybe they can help:

Link of class 'Lorg/ektorp/impl/docref/DocumentReferenceSerializerProvider;' failed
Could not find class 'org.ektorp.impl.docref.DocumentReferenceSerializerProvider', referenced from method org.ektorp.impl.StdObjectMapperFactory.createObjectMapper

I don't understand what they mean. Any idea ?


I'm afraid that Ektorp 1.1.1 is not compatible with Jackson 1.8. This will be fixed in the 1.2.0 release due this summer. Use Jackson 1.7.7 in the mean time.


I'm not an expert java coder but I imagine the java object its extending before the exception is not part of the java implementation running on android. Dalvik is not a standard jvm. I'd recommend this https://github.com/couchone/libcouch-android library for couch on android.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜