`
远去的渡口
  • 浏览: 472967 次
  • 性别: Icon_minigender_2
  • 来自: 上海转北京
社区版块
存档分类
最新评论

Ibatis错误 Error parsing XPath '/sqlMapConfig/sqlMap'.

阅读更多

今天遇到了一个异常,困扰的时间比较长,觉得挺郁闷的,开始以为是哪里的配置文件被修改错了。后来才发现,原来是我的sql-map中的某个语句写的有问题。将sql语句改正确后就ok了。标记一下。

 

异常信息如下:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [config/spring/spring-application.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [config/ibatis/sqlmap-config.xml]; nested exception is 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
	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:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [config/ibatis/sqlmap-config.xml]; nested exception is 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:342)
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:292)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
	... 30 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:55)
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:339)
	... 33 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	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:60)
	... 36 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMap/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse(SqlMapParser.java:44)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$10.process(SqlMapConfigParser.java:257)
	at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)
	... 40 more
Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMap/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	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:60)
	... 43 more
Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getParameterMap(SqlMapExecutorDelegate.java:327)
	at com.ibatis.sqlmap.engine.config.MappedStatementConfig.<init>(MappedStatementConfig.java:52)
	at com.ibatis.sqlmap.engine.config.SqlMapConfiguration.newMappedStatementConfig(SqlMapConfiguration.java:159)
	at com.ibatis.sqlmap.engine.builder.xml.SqlStatementParser.parseGeneralStatement(SqlStatementParser.java:73)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser$21.process(SqlMapParser.java:362)
	at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)
	... 47 more
2010-10-21 14:54:02 org.apache.catalina.core.StandardContext listenerStart
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [config/spring/spring-application.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [config/ibatis/sqlmap-config.xml]; nested exception is 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
	at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
	at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
	at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
	at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
	at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
	at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
	at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
	at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
	at org.apache.catalina.core.StandardService.start(StandardService.java:516)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
	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:597)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [config/ibatis/sqlmap-config.xml]; nested exception is 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:342)
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.afterPropertiesSet(SqlMapClientFactoryBean.java:292)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
	... 30 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:55)
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:339)
	... 33 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/select'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no parameter map named java.util.HashMap in this SqlMap.
	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:60)
	... 36 more

 

分享到:
评论
2 楼 远去的渡口 2011-10-19  
jiangjingxiaoxuan 写道
能说明一下写错的语句是什么吗?今天下午出现的问题,很烦啊~~~

是一个很明显的sql语句错误吧,现在也忘记具体怎么错的了,出现这个bug其实都是比较低级的错误,细心点就不会了。
1 楼 jiangjingxiaoxuan 2011-10-19  
能说明一下写错的语句是什么吗?今天下午出现的问题,很烦啊~~~

相关推荐

    记一次Ibatis的意外发生.docx

    Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'。这种错误是由于SqlMapConfig.xml文件的配置不正确引起的。 4. IBatis的Namespace 在IBatis中,Namespace是用于区分不同的...

    sql-map-2.dtd和sql-map-config-2.dtd

    DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"&gt; ``` 这样,XML解析器就能够识别并验证配置文件的结构,确保其遵循Ibatis的规范...

    ibatis 连接字符串 SqlMapConfig.xml

    标题中的“ibatis 连接字符串 SqlMapConfig.xml”指的是使用iBATIS(一个轻量级的Java持久层框架)时,配置数据库连接的关键文件——SqlMapConfig.xml。这个文件是iBATIS的核心配置文件,它包含了数据源、事务管理器...

    IBatis.net-IBatis.DataAccess.1.9.2/IBatis.DataMapper.1.6.2

    接着,使用IBatis.DataAccess的SqlMap实例,加载配置文件,通过接口调用执行SQL,例如: ```csharp ISqlMap sqlMap = SqlMap.GetInstance(); sqlMap.Configure("SqlMap.config"); List&lt;MyObject&gt; objects = sqlMap....

    ibatis应用

    应用框架 ibatis. &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL MAP Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd"&gt; ...

    iBatis-设置缓存模式-Java源码(下载)

    PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"&gt; &lt;sqlMap namespace="Account"&gt; &lt;typeAlias alias="Account" type="Account"/&gt; ...

    sql-map-2.dtd

    ibatis的dtd约束,版本2,xml文件中标签提示,网址:http://ibatis.apache.org/dtd/sql-map-2.dtd

    传智播客ibatis视频教程源代码

    Reader reader = com.ibatis.common.resources.Resources.getResourceAsReader("com/itcast/SqlMapConfig.xml"); sqlMapClient = com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(reader); ...

    ibatis-sqlmap-2.3.4.726-sources.jar.zip_birth84v_cutting1v2_ibat

    《深入解析iBatis-SQLMap 2.3.4.726源码》 在Java开发领域,iBatis作为一个优秀的持久层框架,深受广大开发者喜爱。它将SQL语句与Java代码分离,提高了代码的可读性和可维护性。本篇将围绕iBatis-SQLMap 2.3.4.726...

    iBatis框架搭建用到的所有jar包

    所谓“半自动化”,可能理解上有点生涩。纵观目前主流的 ORM(对象关系映射),无论 Hibernate还是Apache OJB,都对数据库结构提供了较为完整的封装,提供了从POJO到数据库表的全套映射机制。程序员往往只需定义好了...

    ibatis个人笔记

    DOCTYPE sqlMap PUBLIC "-//ibatis.apache.org//DTD SQL Map 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-2.dtd"&gt; &lt;sqlMap&gt; &lt;typeAlias alias="Users" type="com.ibatis.Users"/&gt; select * from users ...

    ibatis-sqlmap_2.3.4_2.jar两个版本的jar包

    SqlMapConfig.xml文件是Ibatis-SqlMap的核心配置,包含了数据源、事务管理器等重要设置。 二、版本差异 1. ibatis-sqlmap_2.3.4.jar:这是Ibatis-SqlMap的一个稳定版本,包含了一些bug修复和性能优化。2.3.4版本...

    ibatis-core-3.0.jar org.apache.ibatis.annotations.Param

    `org.apache.ibatis.annotations.Param`是MyBatis中的一个重要注解,用于处理方法参数映射。 `@Param`注解主要用于SQL查询中的动态参数绑定,尤其是在动态SQL语句中。在MyBatis的映射文件或者Mapper接口中,当我们...

    IBatis多数据库,可通过配置指定不同的实体使用不同的数据库

    1.每个实体类需要配置各自的“SqlMap.config”在“config/SysConfig.xml”中,SqlMap,db1.Db1SqlMap就是“ibatis/db1/Db1SqlMap.config”,不同的db将分配不同的mapper类。 2.数据库链接统一放在“config/ibatis/...

    ibatis sqlmap配置详解

    SqlMap的配置是iBatis中应用的核心。这部分任务占据了iBatis开发的...Sql Map配置文件是iBatis配置的核心,从数据库连接到执行SQL时使用的sqlMap文件都是通过此文件中的配置提供给框架的,它通常命名为sqlMapConfig.xml

    Spring高版本对ibatis的支持

    &lt;bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"&gt; &lt;value&gt;classpath:SqlMapConfig.xml&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; &lt;bean id="dao" class="org.springframework....

    ibatis 使用简单配置

    DOCTYPE sqlMapConfig PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN" "http://ibatis.apache.org/dtd/sql-map-config-2.dtd"&gt; &lt;sqlMapConfig&gt; &lt;!-- 配置ibatis框架的连接数据库资源文件 --&gt; ...

    ibatis 学习源码

    PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN" "http://www.ibatis.com/dtd/sql-map-config-2.dtd"&gt; &lt;sqlMapConfig&gt; cacheModelsEnabled="true" enhancementEnabled="true" lazyLoadingEnabled=...

Global site tag (gtag.js) - Google Analytics