java.lang.NoClassDefFoundError:连接Cassandra DB时ch / qos / logback / core / joran / spi / JoranException

阿南德·库玛(Anand Kumar):

我正在尝试通过Java与我的Cassandra实例进行简单连接。我为cqlsh创建了一个“演示”键空间,并在java程序中创建了一个表。代码如下:

使用的罐子:

  • slf4j.api-1.6.1
  • cassandra-all-2.1.2

    public class CassandraConnection {
    
        public static void main(String[] args){
    
            String ipAddress="127.0.0.1";
            String keySpace="demo";
    
            Cluster cluster;
    
            Session session;
    
            cluster=Cluster.builder().addContactPoint(ipAddress).build();
    
            session=cluster.connect(keySpace);
    
            System.out.println("====================Before insert");
    
            String cqlInsertStmt="insert into users (lastname,age,city,email,firstname) values"
            +"('Gopalan',32,'Paramakkudi','[email protected]','Murugan') ";
    
            session.execute(cqlInsertStmt);
    
            String cqlSelectStmt="select * from users";
            ResultSet resultSet=session.execute(cqlSelectStmt);
    
            System.out.println("=================After insert");
    
            for(Row row: resultSet){
    
                System.out.format("%s %s %d %s %s \n", row.getString("firstname"),row.getString("lastname"),row.getInt("age"),row.getString("city"),row.getString("email"));
            }
    
            System.out.println("=================After update");
    
        }
    }
    

我收到以下错误:

Failed to instantiate SLF4J LoggerFactory
Reported exception:
java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
    at com.datastax.driver.core.Cluster.<clinit>(Cluster.java:60)
    at CassandraConnection.main(CassandraConnection.java:21)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more
Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:150)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:124)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:412)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:357)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:383)
    at com.datastax.driver.core.Cluster.<clinit>(Cluster.java:60)
    at CassandraConnection.main(CassandraConnection.java:21)
Caused by: java.lang.ClassNotFoundException: ch.qos.logback.core.joran.spi.JoranException
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 7 more
GhostCat:

您必须确保登录 JAR位于类路径中。

参见此处的入门指南;除此之外;真正的收获是:运行时告诉您找不到某个类;它为您提供了该课程名。或者,您在这里阅读有关Cassandra关于日志备份的评论。

您接受该输入;然后转到您最喜欢的搜索引擎以了解发生了什么。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

Logback提供错误无法将类为'java.lang.String'的对象'3 gb'强制转换为类'ch.qos.logback.core.util.FileSize'

java.lang.NoClassDefFoundError:javax / ws / rs / core / Configuration

java.lang.NoClassDefFoundError:com / fasterxml / jackson / core / JsonFactory

java.lang.ClassNotFoundException:ch.qos.logback.classic.spi.ThrowableProxy?

java.lang.NoClassDefFoundError

连接到嵌入式Derby数据库时出现java.lang.NoClassDefFoundError

Spring Boot-NoClassDefFoundError:ch / qos / logback / classic / Level

ch.qos.logback.core.util.DynamicClassLoadingException:无法实例化类型ch.qos.logback.classic.net.SMTPAppender

使用JUnitCore时java.lang.NoClassDefFoundError

java.lang.NoClassDefFoundError:org / springframework / core / io /资源异常

java.lang.NoClassDefFoundError:org / springframework / core / JdkVersion

java.lang.NoClassDefFoundError:org / springframework / core / env / ConfigurableEnvironment

java.lang.NoClassDefFoundError:org / glassfish / jersey / server / spi / Container

java.lang.NoClassDefFoundError:org / hibernate / boot / registry / classloading / spi / ClassLoaderService

无法将ClassCaseException org.slf4j.impl.SimpleLoggerFactory强制转换为ch.qos.logback.classic.LoggerContext

java.lang.NoClassDefFoundError:org / springframework / core / ResolvableType

SonarQube错误正在运行主要:java.lang.NoSuchMethodError:ch.qos.logback.classic.LoggerContext.initCollisionMaps()V

java.lang.NoClassDefFoundError:休眠5.3.1中的org / hibernate / cache / spi / TransactionalDataRegion

java.lang.NoClassDefFoundError:使用FlexboxLayout时androidx / core / view / ViewCompat

Tomcat找不到外部jar-java.lang.NoClassDefFoundError:org / opencv / core / Core

java.lang.NoClassDefFoundError:com / google / api / core / ApiFuture

Spark Cassandra连接器错误:java.lang.NoClassDefFoundError:com / datastax / spark / connector / TableRef

尝试使用Twitter连接器时java.lang.NoClassDefFoundError:org / mule / api / ConnectionException

“ java.lang.NoClassDefFoundError”

java.lang.NoClassDefFoundError:javax / servlet / jsp / jstl / core / ConditionalTagSupport

log4j2和ch.qos.logback.core.PropertyDefinerBase

java.lang.NoClassDefFoundError:org / opencv / core / Core-Java Servlet + OpenCV

org.slf4j.helpers.SubstituteLogger无法转换为ch.qos.logback.classic.Logger

依赖“ logback-classic”的Maven仍然给出“ java.lang.NoClassDefFoundError:org / slf4j / LoggerFactory”异常

TOP 榜单

  1. 1

    来自Microsoft Office加载项taskpane.js的MySQL驱动程序模块的空引用

  2. 2

    使用AWS Cognito和React的仅限Facebook / Google的登录名(无用户名/密码)

  3. 3

    创建Windows Phone 8应用并将其连接到数据库的最佳方法(最好是SQL Server)

  4. 4

    为什么Java中的System.out.println()打印到控制台?

  5. 5

    卷曲函数无法解析来自bash中变量的代理

  6. 6

    是什么在Android的consumer-rules.pro和proguard-rules.pro之间的区别?

  7. 7

    设置与Apache POI Excel表散点图标记图标的颜色

  8. 8

    将Qt Pyside2与asyncio await语法一起使用?

  9. 9

    崇高的文字+蟒蛇的蟒蛇

  10. 10

    任务':app:minifyReleaseWithR8'.java.lang.NullPointerException的执行失败(无错误消息)

  11. 11

    OpenJDK的和AdoptOpenJDK的区别

  12. 12

    大型数据集缓存到Spark内存中时,“超出了GC开销限制”(通过sparklyr和RStudio)

  13. 13

    “执行测试CMAKE_HAVE_LIBC_PTHREAD”失败实际上是什么意思?

  14. 14

    使用Core 2.2中的Identity,如何在关闭浏览器15分钟后保持会话活动?

  15. 15

    React中的ForwardRefExoticComponent和ForwardRefRenderFunction有什么区别?

  16. 16

    猫鼬查找结果,然后将字段替换为findOne

  17. 17

    如何降级Google Colab的Torch版本

  18. 18

    Keras提前停止回调错误,val_loss指标不可用

  19. 19

    如何避免VSCode中的“导入路径不能以.ts扩展名结尾”错误?

  20. 20

    Nuxt.JS:如何在页面中获取路由URL参数

  21. 21

    是否有为什么会AccessibilityManager.sInstance导致内存泄漏的一个原因?

热门标签

归档