java.lang.ExceptionInInitializerError
2016-11-13 21:06
288 查看
该异常主要是因为,你的初始化文件有问题:
异常信息
java.lang.ExceptionInInitializerError
at com.bjsxt.lc.dao.impl.BasicDaoImpl.insert(BasicDaoImpl.java:23)
at com.bjsxt.user.service.impl.RoloServiceImpl.insertRoleService(RoloServiceImpl.java:23)
at com.bjsxt.lc.test.service.TestRoleServiceImpl.testAddrole(TestRoleServiceImpl.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.hibernate.boot.MappingNotFoundException: Mapping (RESOURCE) not found : com/bjsxt/user/pojo/ARole.hbm.xmll : origin(com/bjsxt/user/pojo/ARole.hbm.xmll)
at org.hibernate.boot.spi.XmlMappingBinderAccess.bind(XmlMappingBinderAccess.java:56)
at org.hibernate.boot.MetadataSources.addResource(MetadataSources.java:274)
at org.hibernate.boot.cfgxml.spi.MappingReference.apply(MappingReference.java:70)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:413)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179)
at com.bjsxt.lc.util.HibernateUtil.<clinit>(HibernateUtil.java:18)
... 26 more
分析:可以看到原因来自在hibernate.cfg.xml文件里的 地址没有找到:
mapping:里的rescouce属性,引入POJO的的配置文件的时候,路径有问题,导致初始化信息有问题
解决方案:
ctrl+鼠标。。看看能不能进到该配置文件,如果不能。注意看看有什么地方写错了
异常信息
java.lang.ExceptionInInitializerError
at com.bjsxt.lc.dao.impl.BasicDaoImpl.insert(BasicDaoImpl.java:23)
at com.bjsxt.user.service.impl.RoloServiceImpl.insertRoleService(RoloServiceImpl.java:23)
at com.bjsxt.lc.test.service.TestRoleServiceImpl.testAddrole(TestRoleServiceImpl.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:678)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.hibernate.boot.MappingNotFoundException: Mapping (RESOURCE) not found : com/bjsxt/user/pojo/ARole.hbm.xmll : origin(com/bjsxt/user/pojo/ARole.hbm.xmll)
at org.hibernate.boot.spi.XmlMappingBinderAccess.bind(XmlMappingBinderAccess.java:56)
at org.hibernate.boot.MetadataSources.addResource(MetadataSources.java:274)
at org.hibernate.boot.cfgxml.spi.MappingReference.apply(MappingReference.java:70)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:413)
at org.hibernate.boot.internal.MetadataBuilderImpl.build(MetadataBuilderImpl.java:87)
at org.hibernate.boot.MetadataSources.buildMetadata(MetadataSources.java:179)
at com.bjsxt.lc.util.HibernateUtil.<clinit>(HibernateUtil.java:18)
... 26 more
分析:可以看到原因来自在hibernate.cfg.xml文件里的 地址没有找到:
mapping:里的rescouce属性,引入POJO的的配置文件的时候,路径有问题,导致初始化信息有问题
解决方案:
ctrl+鼠标。。看看能不能进到该配置文件,如果不能。注意看看有什么地方写错了
相关文章推荐
- java.lang.ExceptionInInitializerError异常解决小结
- java.lang.ExceptionInInitializerError的原因(转)
- java.lang.ExceptionInInitializerError
- Java java.lang.ExceptionInInitializerError 错误解决方案
- Exception in thread "Timer-0" java.lang.ExceptionInInitializerError 解决方法
- Exception in thread "main" java.lang.ExceptionInInitializerError
- java.lang.ExceptionInInitializerError
- java.lang.ExceptionInInitializerError
- java.lang.ExceptionInInitializerError
- java.lang.ExceptionInInitializerError
- Java java.lang.ExceptionInInitializerError 错误解决方案
- java.lang.ExceptionInInitializerError hibernate 错误解决
- Java java.lang.ExceptionInInitializerError 错误解决方案
- java.lang.ExceptionInInitializerError Library amapv3 not found解决办法
- (转)java.lang.ExceptionInInitializerError
- 学习笔记:java.lang.ExceptionInInitializerError
- Android错误:java.lang.ExceptionInInitializerError,java.lang.UnsatisfiedLinkError,
- FATAL EXCEPTION: Thread-7890 java.lang.ExceptionInInitializerError
- Exception in thread "main" java.lang.ExceptionInInitializerError
- java.lang.ExceptionInInitializerError的原因