使用Cassandras JAVA API时出错

时间:2015-11-18 12:55:43

标签: java api log4j jackson cassandra-2.0

我正在尝试通过JAVA API连接到Cassandra。 我经常遇到java.lang.ClassNotFoundException,因为无法找到org.codehaus.jackson.annotate.JsonClass。我尝试使用另一个Cassandra JAR,但它可能是错误的。谁能帮我找到合适的JAR?

我正在使用Cassandra 2.2.0。

以下是控制台输出:

log4j:WARN No appenders could be found for logger (com.datastax.driver.core.Cluster).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.NoClassDefFoundError: org/codehaus/jackson/annotate/JsonClass
    at org.codehaus.jackson.map.introspect.JacksonAnnotationIntrospector.findDeserializationType(JacksonAnnotationIntrospector.java:524)
    at org.codehaus.jackson.map.deser.BasicDeserializerFactory.modifyTypeByAnnotation(BasicDeserializerFactory.java:732)
    at org.codehaus.jackson.map.deser.BasicDeserializerFactory.createMapDeserializer(BasicDeserializerFactory.java:337)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider._createDeserializer(StdDeserializerProvider.java:377)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCache2(StdDeserializerProvider.java:307)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider._createAndCacheValueDeserializer(StdDeserializerProvider.java:287)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider.findValueDeserializer(StdDeserializerProvider.java:136)
    at org.codehaus.jackson.map.deser.StdDeserializerProvider.findTypedValueDeserializer(StdDeserializerProvider.java:157)
    at org.codehaus.jackson.map.ObjectMapper._findRootDeserializer(ObjectMapper.java:2468)
    at org.codehaus.jackson.map.ObjectMapper._readMapAndClose(ObjectMapper.java:2402)
    at org.codehaus.jackson.map.ObjectMapper.readValue(ObjectMapper.java:1602)
    at com.datastax.driver.core.TableMetadata.fromJsonMap(TableMetadata.java:264)
    at com.datastax.driver.core.KeyspaceMetadata.build(KeyspaceMetadata.java:48)
    at com.datastax.driver.core.Metadata.rebuildSchema(Metadata.java:85)
    at com.datastax.driver.core.ControlConnection.refreshSchema(ControlConnection.java:265)
    at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:220)
    at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:168)
    at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:81)
    at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:644)
    at com.datastax.driver.core.Cluster$Manager.access$100(Cluster.java:586)
    at com.datastax.driver.core.Cluster.<init>(Cluster.java:69)
    at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:96)
    at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:567)
    at com.db.connector.CassandraCQLClient.init(CassandraCQLClient.java:142)
    at com.main.Main_DB.main(Main_DB.java:51)
Caused by: java.lang.ClassNotFoundException: org.codehaus.jackson.annotate.JsonClass
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 25 more

0 个答案:

没有答案