Spring整合Ibatis的时候,出现如下异常:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.ibatis.common.SqlMapConfig.getIntance(SqlMapConfig.java:53)
at com.ibatis.dao.impl.pt_NameDaoImpl.query(pt_NameDaoImpl.java:108)
at com.ibatis.dao.impl.pt_NameDaoImpl.main(pt_NameDaoImpl.java:162)
Caused by: java.lang.RuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: The content of element type "sqlMapConfig" must match "(properties?,settings?,resultObjectFactory?,typeAlias*,typeHandler*,transactionManager?,sqlMap+)+".
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:49)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at com.ibatis.common.SqlMapConfig.<init>(SqlMapConfig.java:34)
at com.ibatis.common.SqlMapConfig.<init>(SqlMapConfig.java:29)
at com.ibatis.common.SqlMapConfig$SingletonHolder.<clinit>(SqlMapConfig.java:49)
... 3 more
这是ibatis的bug,参考:https://issues.apache.org/jira/browse/IBATIS-517
解决方案:使用ibatis2.3.2以上的版本
本文转自 zhouhaipeng 51CTO博客,原文链接:http://blog.51cto.com/tianya23/697665,如需转载请自行联系原作者