`
Ben.Sin
  • 浏览: 234152 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

iBatis异常There is no statement named update in this SqlMap.

    博客分类:
  • Java
阅读更多

最近使用iBatis搭建项目架构的时候遇到了一个异常,如下文所示

 

 

Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.

 

但是搜索所有SqlMap的上下文,都没有发现There is no statement named update in this SqlMap

 

无论是<cacheModel/>还是<update/>都没有遗漏update的statement. 后来经google后发现,原来cacheModel中需要指定namespace, 加上之后就一切正常了。

 

(此文标记一下,以备不时之需)

 

 

产生异常的cacheModel

<cacheModel id="xxx-cache" type ="LRU" readOnly="true" serialize="false">
	<flushInterval hours="24"/>
	<flushOnExecute statement="insert"/>
	<flushOnExecute statement="update"/>
	<flushOnExecute statement="delete"/>
	<property name="cache-size" value="1000"/>
</cacheModel>

<update id="update" parameterClass="...">
	...
</update>

 

正常的cacheModel配置

<cacheModel id="xxx-cache" type ="LRU" readOnly="true" serialize="false">
	<flushInterval hours="24"/>
	<flushOnExecute statement="namespace.insert"/>
	<flushOnExecute statement="namespace.update"/>
	<flushOnExecute statement="namespace.delete"/>
	<property name="cache-size" value="1000"/>
</cacheModel>

<update id="update" parameterClass="...">
	...
</update>

 

[INFO ] [09:18:05] org.springframework.beans.factory.support.DefaultListableBeanFactory:421 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1113622: defining beans [dataSource,dataSource2,transactionManager,sqlMapClient,baseDao,baseTransProxy,auserDao,auserLoginHisDao,auserViewHisDao,personDao,auserService,auserLoginHisService,auserViewHisService,personService,propertyConfigurer]; root of factory hierarchy
[ERROR] [09:18:05] org.springframework.web.context.ContextLoader:215 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlMapClient' defined in class path resource [dataAccessContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [net/inforcn/inforcnSqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update 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:3843)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	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:578)
	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 [net/inforcn/inforcnSqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update 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)
	... 39 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:106)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:95)
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:339)
	... 42 more
Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)
	at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105)
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:60)
	... 45 more
Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$1.process(SqlMapConfigParser.java:124)
	at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)
	... 48 more
2009-10-26 9:18:05 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 [dataAccessContext.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse config resource: class path resource [net/inforcn/inforcnSqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update 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:3843)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:627)
	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1149)
	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:117)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
	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:578)
	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 [net/inforcn/inforcnSqlMapConfig.xml]; nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update 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)
	... 39 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:62)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:106)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:95)
	at org.springframework.orm.ibatis.SqlMapClientFactoryBean.buildSqlMapClient(SqlMapClientFactoryBean.java:339)
	... 42 more
Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/end()'.  Cause: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.
	at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)
	at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:105)
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)
	at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:60)
	... 45 more
Caused by: com.ibatis.sqlmap.client.SqlMapException: There is no statement named update in this SqlMap.
	at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.getMappedStatement(SqlMapExecutorDelegate.java:293)
	at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$1.process(SqlMapConfigParser.java:124)
	at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)
	... 48 more
2009-10-26 9:18:05 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-10-26 9:18:05 org.apache.catalina.core.StandardContext start
严重: Context [/benweb] startup failed due to previous errors
2009-10-26 9:18:05 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2009-10-26 9:18:06 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
分享到:
评论

相关推荐

    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-sqlmap_2.3.4_2.jar两个版本的jar包

    Ibatis-SqlMap是早期非常流行的一款Java持久层框架,由Cody Aravena创建,后被Apache基金会接管并更名为MyBatis。本篇将详细阐述Ibatis-SqlMap 2.3.4和2两个版本的主要知识点。 一、Ibatis-SqlMap简介 Ibatis-...

    ibatis sqlmap配置详解

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

    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; ...

    ibatis-sqlmap-2.jar.zip

    《深入解析iBatis-SQLMap 2》 在Java Web开发领域,iBatis作为一个优秀的持久层框架,因其灵活性和高效性而深受开发者喜爱。本文将深入探讨iBatis-SQLMap 2版本,主要关注`ibatis-sqlmap-2.jar.zip`这个压缩包中的...

    ibatis 中sqlMap配置

    在 iBatis 框架中,SQLMap配置是整个应用程序的核心部分,占据了大部分的开发工作。下面将详细解析 iBatis 中SQLMap配置的关键知识点: 1. **命名空间(Namespace)**: 命名空间是iBatis配置中的一个重要概念,它...

    ibatis-sqlmap-2.jar

    ibatis-sqlmap-2.jar.........

    ibatis-2.3.4.726.jar

    8. Exception Handling:iBATIS有一套完善的异常处理机制,可以根据不同的数据库错误返回自定义的异常信息,方便开发者调试和处理问题。 9. 兼容性:iBATIS支持多种数据库,如MySQL、Oracle、SQL Server等,通过...

    Manning.iBATIS.in.Action.Jan.2007.eBook-BBL.pdf

    根据提供的文件信息,本书《Manning iBATIS in Action Jan. 2007 eBook-BBL》主要介绍了iBATIS框架的基本概念、安装配置方法、核心功能及其在实际项目中的应用。下面将针对该书籍中提及的主要知识点进行详细阐述。 ...

    ibatis-sqlmap-2.3.0中sqlmap支持通配符

    Ibatis的`&lt;isNotEmpty&gt;`、`&lt;isEqual&gt;`等标签可以用来根据传入的参数决定是否插入通配符。例如,如果想在有搜索关键词时才进行模糊匹配: ```xml &lt;select id="selectByLike" parameterType="map" resultType="com....

    iBATIS内置别名列表

    1. **JDBC**:`com.ibatis.sqlmap.engine.transaction.jdbc.JdbcTransactionConfig` - JDBC事务管理器是最简单的事务管理方式,适用于不需要复杂事务控制的场景。 2. **JTA**:`...

    Asp.net 应用Ibatis 小例子

    **Asp.net 应用Ibatis 小例子** 在Asp.net开发中,Ibatis是一个常用的持久层框架,它提供了一种将业务逻辑与数据库操作分离的方法,使得代码更加清晰,易于维护。Ibatis的核心思想是SQL映射,即将SQL语句与Java代码...

    ibatis应对批量update

    ### ibatis应对批量update 在处理大量数据更新时,传统的for循环方式往往会导致效率低下。这是因为每一次循环都需要执行一次数据库连接操作,对于批量更新来说,这样的处理方式显然不够高效。为了解决这个问题,...

    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源码 例子

    import com.ibatis.sqlmap.client.SqlMapClientBuilder; import com.icss.model.Employee; public class EmployeeDAO { private static SqlMapClient sqlMapper; static { try { Reader reader = Resources....

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

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

    ibatis-sqlmap-2.3.4.741-sources.zip_4 3 2 1_ibatis-sqlm_ibatis-s

    标题 "ibatis-sqlmap-2.3.4.741-sources.zip_4 3 2 1_ibatis-sqlm_ibatis-s" 暗示了这是一个关于iBATIS SQLMap的源码包,版本号为2.3.4.741,可能是一个增强或修改后的版本,具有特定的优化和改进。描述中提到了针对...

    记一次Ibatis的意外发生.docx

    这个类中import了多个包,包括com.ibatis.common.xml.NodeletException、com.ibatis.sqlmap.client.SqlMapClient、com.ibatis.sqlmap.client.SqlMapClientBuilder等。需要注意的是,IBatis的包声明是org.apache....

Global site tag (gtag.js) - Google Analytics