首页 > mybatis-错误记录java.lang.ExceptionInInitializerError

mybatis-错误记录java.lang.ExceptionInInitializerError

  今天刚学习mybatis,遇到了一个错误,纠结了半天的时间,所以将发现的问题和解决得方法写一下。

  错误信息如下:

java.lang.ExceptionInInitializerErrorat com.ibatis.po.TestSysArea.testInsert(TestSysArea.java:31)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)at java.lang.reflect.Method.invoke(Method.java:585)at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)at org.junit.runners.ParentRunner.run(ParentRunner.java:236)at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)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.RuntimeException: Error occurred.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'.  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'AreaCode' in class 'com.ibatis.po.SysArea'at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:89)at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)at com.ibatis.po.SysAreaDaoImpl.(SysAreaDaoImpl.java:19)... 23 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'.  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'AreaCode' in class 'com.ibatis.po.SysArea'at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86)... 25 more
Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'.  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'AreaCode' in class 'com.ibatis.po.SysArea'at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:84)at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)... 26 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'.  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'AreaCode' in class 'com.ibatis.po.SysArea'at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse(SqlMapParser.java:51)at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$11.process(SqlMapConfigParser.java:410)at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)... 30 more
Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMap/insert'.  Cause: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'AreaCode' in class 'com.ibatis.po.SysArea'at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:84)at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)... 33 more
Caused by: com.ibatis.common.beans.ProbeException: There is no READABLE property named 'AreaCode' in class 'com.ibatis.po.SysArea'at com.ibatis.common.beans.ClassInfo.getGetterType(ClassInfo.java:287)at com.ibatis.common.beans.GenericProbe.getClassPropertyTypeForGetter(GenericProbe.java:224)at com.ibatis.common.beans.GenericProbe.getPropertyTypeForGetter(GenericProbe.java:153)at com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.resolveTypeHandler(InlineParameterMapParser.java:229)at com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.newParseMapping(InlineParameterMapParser.java:138)at com.ibatis.sqlmap.engine.mapping.parameter.InlineParameterMapParser.parseInlineParameterMap(InlineParameterMapParser.java:50)at com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.applyInlineParameterMap(SqlStatementParser.java:427)at com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.processSqlStatement(SqlStatementParser.java:215)at com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralStatement(SqlStatementParser.java:120)at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$19.process(SqlMapParser.java:563)at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)... 37 more

   这个问题主要是因为在SysArea 配置文件中,由于SQL语句中赋值语句中变量首字母大写的缘故,所以会报这样的错误,只要我们在写语句时和PO中的属性名一致即可。

转载于:https://www.cnblogs.com/fang-s/archive/2013/02/17/2913935.html

更多相关:

  • 该楼层疑似违规已被系统折叠 隐藏此楼查看此楼使用的是MySQL8+,nacos是1.2.1的,在网上翻了很多资料,查了很多博客,也尝试了很多,在nacos文件夹下创建plugins/mysql文件夹并放入MySQL的jar包、在nacos的application.properties的文件中添加MySQL高版本的驱动配置等等等等,但是...

  • SpringBoot默认上传文件大小不能超过1MB,超过之后会报以下异常: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: The field file exceeds its maximum permitte...

  • 首先我们使用新的API方法连接mysql加载数据 创建DF import org.apache.spark.sql.DataFrame import org.apache.spark.{SparkContext, SparkConf} import org.apache.spark.sql.{SaveMode, DataFrame...

  • 本文目的是测试将shark和hadoop2进行整合。 本来打算使用Shark 最新版0.9.0 ,但是官方好像还没有针对与Hadoop2的正式下载地址。(这个要说明一下,官方只提供了源码,并没有找到编译好的0.9.0 for hadoop2 ,也许需要自己编译一个,没有证实) shark0.9.0 的需要: Scala 2.10.3S...

  • 7.非理想情况 (1)积分饱和 到目前为止,我们一直使用的“理想”形式的PID控制器很少用于工业中。“时间常数”形式更为常见。 当前说明了理想形式的一些重大缺陷。 在一个经过良好调整的系统中,积分项能够通过使控制作用力与累积误差成比例来消除稳态误差。然而,这种操作模式会带来危险。设想,如果设定值突然大幅度改变但系统动力学相应缓...

  • 为什么80%的码农都做不了架构师?>>>    Notice: Undefined variable解决办法    默认配置会报这个错误,我的PHP版本是5.2.13,存在这个问题:      Notice: Undefined variable      这就是将警告在页面上打印出来,虽然这是有利于暴露问题,但实现使...

  • 1、Warning: mysql_connect() [function.mysql-connect]: Access denied for user‘beijingphp’@'localhost’ (using password: YES) in  …..   on line 3 Access denied for user ‘b...