当前位置: 代码迷 >> Java Web开发 >> hibernate中Exception in thread "main" java.lang.ExceptionInInitializerError异常
  详细解决方案

hibernate中Exception in thread "main" java.lang.ExceptionInInitializerError异常

热度:121   发布时间:2016-04-17 10:58:25.0
hibernate中Exception in thread "main" java.lang.ExceptionInInitializerError错误
晚上用马士兵的hibernate练习项目做了一个导入,但是一直报slf4j错误,后根据视频把jar包引入,
但是又出现了以下错误:
Java code
SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/D:/Jar%20Package/slf4j-1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: Found binding in [jar:file:/D:/Jar%20Package/slf4j-1.6.4/slf4j-nop-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.Exception in thread "main" java.lang.ExceptionInInitializerError    at org.hibernate.cfg.Configuration.reset(Configuration.java:217)    at org.hibernate.cfg.AnnotationConfiguration.reset(AnnotationConfiguration.java:233)    at org.hibernate.cfg.Configuration.<init>(Configuration.java:197)    at org.hibernate.cfg.Configuration.<init>(Configuration.java:201)    at org.hibernate.cfg.AnnotationConfiguration.<init>(AnnotationConfiguration.java:108)    at com.bjsxt.hibernate.HibernateQLTest.beforeClass(HibernateQLTest.java:21)    at com.bjsxt.hibernate.HibernateQLTest.main(HibernateQLTest.java:367)Caused by: java.lang.NullPointerException    at org.hibernate.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:167)    at org.hibernate.cfg.Environment.<clinit>(Environment.java:575)    ... 7 more


真是不知道少了哪个包,很讨厌这种小错误,浪费了一晚上,请朋友们帮分析下。谢谢

------解决方案--------------------
看错误貌似是导入包重复了
Java code
jar:file:/D:/Jar%20Package/slf4j-1.6.4/slf4j-log4j12-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class;jar:file:/D:/Jar%20Package/slf4j-1.6.4/slf4j-nop-1.6.4.jar!/org/slf4j/impl/StaticLoggerBinder.class
  相关解决方案