Hibernate4配置项目时发生异常
java.lang.ExceptionInInitializerError
at org.hibernate.cfg.Configuration.reset(Configuration.java:299)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:265)
at org.hibernate.cfg.Configuration.<init>(Configuration.java:269)
at wzh.main.util.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:27)
at basic.master.Test1.test(Test1.java:12)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: java.lang.NullPointerException
at org.hibernate.internal.util.ConfigHelper.getResourceAsStream(ConfigHelper.java:170)
at org.hibernate.cfg.Environment.<clinit>(Environment.java:221)
... 28 more
此异常表面上看意思是类文件的静态初始化块出现异常。
我的解决方案:因为我的JAR包是通过User libraries引入的(当然,eclipse如果只引入User Libraries的话,在编译的时候会报classFoundException错误的),而在创建User Libraries时我把它设成了System Libraries了(就是在创建其名称是下面有一个选项),取消其System
Libraries属性就行了。
分享到:
相关推荐
主要为大家详细介绍了java.lang.ExceptionInInitializerError异常的解决方法,具有一定的参考价值,感兴趣的小伙伴们可以参考一下
主要介绍了 Java java.lang.ExceptionInInitializerError 错误如何解决的相关资料,需要的朋友可以参考下
本篇文章主要介绍了Android studio报: java.lang.ExceptionInInitializerError错误的解决方法,具有很好的参考价值。下面跟着小编一起来看下吧
主要介绍了解决出现 java.lang.ExceptionInInitializerError错误问题的相关资料,需要的朋友可以参考下
Exception in thread "Thread-1" java.lang.ExceptionInInitializerError at com.semaphore.jna.md.MDLibrary.<clinit>(MDLibrary.java:39) at ...
java.lang.ExceptionInInitializerError Caused by: java.lang.IllegalArgumentException: input == null! at javax.imageio.ImageIO.read(ImageIO.java:1388) at com.pleanwar.fiying.FlyingObject.loadImage...
java.lang.ExceptionInInitializerError 初始化程序错误。当执行一个类的静态初始化程序的过程中,发生了异常时抛出。静态初始化程序是指直接包含于类中的static语句段。 java.lang.IllegalAccessError 违法访问...
链接is unknown to this NavController
context with path [] threw exception [org.glassfish.jersey.server.ContainerException: java.lang.ExceptionInInitializerError: Native library sapjco3 is too old. Found library C:\Windows\System32\sapjco...
weblogic12c部署webservice错误问题WSSERVLET11: 无法解析运行时描述符: java.lang.IllegalStateException: MASM0001:
更好用的udig制图软件,因官网下载速度慢,特此分享!
springboot 整合dubbo 供大家交流学习使用,一个小demo
NULL 博文链接:https://mwhgjava.iteye.com/blog/1323320
在Java等面向对象的编程语言中,异常本身就是一个类,产生异常就是创建异常对象并抛出一个异常类,Java处理异常的方式是中断处理。 可能这时候你就会问了,你在这巴拉巴拉半天说啥呢? 那我们就来看一个例子,平常...
Java.lang 包中还定义了许多异常类,例如: 1. AbstractMethodError:抽象方法错误,当应用试图调用抽象方法时抛出。 2. AssertionError:断言错,用于指示一个断言失败的情况。 3. ClassCircularityError:类循环...
openjdk8高山软件包 之所以能够使用版本openjdk8-8.232.09-r0,是因为openjdk8-8.242中断了...java.lang.ExceptionInInitializerError at java.lang.management.ManagementFactory.getOperatingSystemMXBean(Managemen
import java.io.File;... throw new ExceptionInInitializerError(e); } } public static DaoFactory getInstance() { return instance; } public UserDao getUserDao() { return userDao; } }
throw new ExceptionInInitializerError("属性文件加载错误"); } finally { try { is.close(); } catch (Exception e) { } } url = infos.getProperty(URL); } public static Connection ...
机器人测试使用Robot Framework执行的... 如果您使用的Java版本不正确,则会发生Java 64位安装(因为SikuliLibrary库需要执行桌面交互)的错误:## java.lang.exceptionininitializererror:null ##请遵循下载链接: 我