我是这样导入hibernate的:
自己建立的一个包库,把hibernate所需要的jar包放进去,然后项目里使用的时候直接导入
如图:
可是这样用的时候测试出错,错误如下:
Exception in thread "main" java.lang.ExceptionInInitializerError
at org.zxy.model.StudentTest.main(StudentTest.java:13)
Caused by: java.lang.NullPointerException
at org.slf4j.LoggerFactory.singleImplementationSanityCheck(LoggerFactory.java:192)
at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:113)
at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:269)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:242)
at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:255)
at org.hibernate.cfg.Configuration.<clinit>(Configuration.java:152)
... 1 more
检查了好几次,配置文件和类都是正确的
后来把这个包库去掉,直接导入jar
这样问题就解决了