【报错】ClassNotFoundException: org.apache.log4j.Level

【报错】

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Level

    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:111)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:268)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:241)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:254)
    at org.hibernate.cfg.Configuration.(Configuration.java:197)
    at com.tgbnode.hibernate.Client.main(Client.java:14)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Level
    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

【解决】

添加 log4j 的 Jar 文件。

你可能感兴趣的:(JavaWeb贴士)