解决java.lang.NoClassDefFoundError: org/apache/log4j/Level

现象:
java.lang.NoClassDefFoundError: org/apache/log4j/Level
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:230)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:121)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:112)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:275)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:248)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:261)
    at HttpUtils2.<clinit>(HttpUtils2.java:66)

原因其实是缺少log4j相关的jar,在classpath中加入log4j-1.2.14.jar即可解决问题。

posted @ 2016-08-19 13:32  Earic  阅读(34941)  评论(0编辑  收藏  举报