hibernate出现Exception in thread "main " java.lang.ExceptionInInitializerError错误解决办法
来源:互联网 发布:js div滑动效果 编辑:程序博客网 时间:2024/06/05 12:50
最近复习了下hibernate的内容,用于准备面试。另外看了下尚学堂的视频,按照步骤去做了几个实验,
但是在这过程中遇到了以下错误问题:
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
后经网上查找,原因在于自己在eclipse中增加user library的时候有个复选框"System libary(added to the boot class path)",这个东西不要勾上了,我就是把这个勾上了所以就不行了。以上你要排除你正确的导入了所有必须的包。
以上解决问题方法来自于csdn一位朋友的回帖,非常感谢。
另外在该问题出现之前也会出现slf4j的相关错误,你要确保user library下的jar包应该完整。
为方便大家不走弯路,在这里给大家贴出来需要的jar包:
大家可以根据上述jar包参考来加入。
- hibernate出现Exception in thread "main " java.lang.ExceptionInInitializerError错误解决办法
- Exception in thread "main" java.lang.ExceptionInInitializerError
- Exception in thread "main" java.lang.ExceptionInInitializerError
- Exception in thread "main" java.lang.ExceptionInInitializerError
- Exception in thread "main" java.lang.ExceptionInInitializerError
- 解决Eclipse启动JBoss7.1异常的问题(Exception in thread "main" java.lang.ExceptionInInitializerError)
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- Eclipse 报 “Exception in thread "main" java.lang.OutOfMemoryError: Java heap space ”错误的解决办法
- hibernate中出现Exception in thread "main" java.lang.NoClassDefFoundError: com/opensymphony/oscache/base
- 为什么在编译java时会出现Exception in thread "main" java.lang.NoClassDefFoundError错误?
- 解决办法 Exception in thread "main" java.lang.NoClassDefFoundError
- Exception in thread "main" java.lang.UnsatisfiedLinkError 的一种解决办法
- Exception in thread "main" java.lang.NoClassDefFoundError 问题的解决办法
- Exception in thread"main" java.lang.NoClassDefFoundError的解决办法
- SAP BW平面文件特征数据的加载——视频学习笔记04和05
- ecmall template.php——select(string) $t[file] 的错误信息
- Android 开发指南 翻译6 Accessing Resources
- 支持在Ubuntu 8.10、Ubuntu 9.04系统上自动安装微软雅黑、monaco-linux、lu...
- for语句–shell
- hibernate出现Exception in thread "main " java.lang.ExceptionInInitializerError错误解决办法
- Fedora16安装和自启动Mysql
- 浅谈xml解析
- Ni3DRenderView
- php中global与$GLOBAL的用法及区别
- 设计模式--设计模式总览表
- Blackberry强制横竖屏
- 实用英文10000单词
- Android 4.0 +MyEclipse 9 整合开发环境搭建