`
zscomehuyue
  • 浏览: 411832 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

com.ibatis.common.jdbc.exception.NestedSQLException:

阅读更多
异常的处理
情况1:
com.ibatis.common.jdbc.exception.NestedSQLException: 
--- The error occurred in com/contract/ibatis/mapping/PayInfo.xml.
--- The error occurred while applying a result map.
--- Check the getPayInfoByContractCodeOrPayType-AutoResultMap.
--- The error happened while setting a property on the result object.
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error setting properties of 'com.contract.struts.form.PayInfoForm@15b7644'. Cause: java.lang.IllegalArgumentException
Caused by: java.lang.IllegalArgumentException

    反复检查各个文件,始终找不出问题所在。baidu,google了半天,碰到过这个异常的人不多,还多是些外国人,只有提问的没有回答的,找了一下午眼睛备受摧残。

    最后在我无数次的试验过程中,终于知道为什么会抛这个异常了。xml,DAO,form,action都没问题,问题的根源在于数据库里的一条记录,在定义表的时候有几个字段定义了默认值,而我一上午都在试存储过程,试的时候插进去了一条记录,本该有默认值的那几个字段为空,所以The error happened while setting a property on the result object. 把那条记录的那几个字段改成默认值,一切OK。
情况2:
ibatis设置非懒加载时出现在关联查询中如果子查询没有数据会出现错误如下:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [-4470];  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- Check the result mapping for the 'subMenu' property. 
--- Cause: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- The error happened while setting a property on the result object. 
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.50.152] 操作无效:已关闭 result set。 ERRORCODE=-4470, SQLSTATE=null; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- Check the result mapping for the 'subMenu' property. 
--- Cause: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- The error happened while setting a property on the result object. 
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.50.152] 操作无效:已关闭 result set。 ERRORCODE=-4470, SQLSTATE=null
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:83)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:80)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:212)
at org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:249)
at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:296)
at com.ibm.crl.gis.map.user.dao.impl.UserDaoImpl.queryFunctionsAndSubByUser(UserDaoImpl.java:226)
at com.ibm.crl.gis.map.user.service.impl.UserServiceImpl.queryFunctionsAndSubByUser(UserServiceImpl.java:743)
at com.ibm.crl.gis.map.user.service.impl.UserServiceImpl.handlerMenuList(UserServiceImpl.java:655)
at com.ibm.crl.gis.map.user.service.impl.UserServiceImpl.queryMenuForExt(UserServiceImpl.java:649)
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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy5.queryMenuForExt(Unknown Source)
at com.ibm.crl.gis.map.user.webapp.action.LoginAction.loadMenu(LoginAction.java:52)
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 com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
at com.ibm.crl.gis.map.core.common.service.impl.DataSourceFilter.intercept(DataSourceFilter.java:64)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:195)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:93)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:235)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:89)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:267)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:126)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:138)
at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:148)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:128)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:176)
at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:468)
at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:228)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:216)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:634)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:445)
at java.lang.Thread.run(Unknown Source)
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- Check the result mapping for the 'subMenu' property. 
--- Cause: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- The error happened while setting a property on the result object. 
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.50.152] 操作无效:已关闭 result set。 ERRORCODE=-4470, SQLSTATE=null
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:298)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:209)
... 84 more
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in ibatis/user/model/function.ibatis.xml. 
--- The error occurred while applying a result map. 
--- Check the querySubByUserResult. 
--- The error happened while setting a property on the result object. 
--- Cause: com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.50.152] 操作无效:已关闭 result set。 ERRORCODE=-4470, SQLSTATE=null
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:201)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryForList(MappedStatement.java:139)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:567)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:541)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:94)
at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult(ResultLoader.java:70)
at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult(ResultLoader.java:57)
at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getNestedSelectMappingValue(ResultMap.java:510)
at com.ibatis.sqlmap.engine.mapping.result.ResultMap.getResults(ResultMap.java:341)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:384)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
... 90 more
Caused by: com.ibm.db2.jcc.b.SqlException: [jcc][t4][10120][10898][3.50.152] 操作无效:已关闭 result set。 ERRORCODE=-4470, SQLSTATE=null
at com.ibm.db2.jcc.b.wc.a(wc.java:55)
at com.ibm.db2.jcc.b.wc.a(wc.java:102)
at com.ibm.db2.jcc.b.jk.Bb(jk.java:3987)
at com.ibm.db2.jcc.b.jk.c(jk.java:273)
at com.ibm.db2.jcc.b.jk.next(jk.java:258)
at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:169)
at org.apache.commons.dbcp.DelegatingResultSet.next(DelegatingResultSet.java:169)
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 com.ibatis.common.jdbc.logging.ResultSetLogProxy.invoke(ResultSetLogProxy.java:47)
at $Proxy17.next(Unknown Source)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:383)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:300)
at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.java:189)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.sqlExecuteQuery(MappedStatement.java:221)
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeQueryWithCallback(MappedStatement.java:189)
... 104 more
把ibatis改为懒加载该错误消失,该问题的真正原因有待进一步思考?

分享到:
评论

相关推荐

    Caused by: java.net.UnknownHostException: openapi.alipay.com

    Caused by: java.net.UnknownHostException: openapi.alipay.com

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

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

    Mybatis报错: org.apache.ibatis.exceptions.PersistenceException解决办法

    在使用Mybatis框架时,你可能会遇到`org.apache.ibatis.exceptions.PersistenceException`这样的异常。这个异常通常表示在执行数据库查询操作时遇到了问题。本篇将详细分析这个问题并提供解决方法。 ### 问题概述 ...

    maven整合ibatis的简单例子

    在Java开发中,Maven和iBatis是两个非常重要的工具。Maven是一个项目管理和综合工具,它帮助开发者管理依赖、构建项目,并提供了一种标准化的项目结构。而iBatis则是一个SQL映射框架,它将SQL语句与Java代码分离,...

    com.springsource.com.ibatis-sources-2.3.4.726.jar

    jar包,官方版本,自测可用

    iBATIS-DAO-2.3.4.726.rar_com.ibatis.dao_iBATIS dao 2_iBatis DAO_

    在源码中,`com.ibatis.dao`包下包含了许多关键类,例如`SqlMapClient`是整个框架的入口,负责管理所有的SQL Maps;`SqlMapExecutor`是执行SQL的接口,提供了各种数据库操作的方法;而`SqlMapSession`则封装了事务...

    com.springsource.com.ibatis-2.3.0.677.jar

    ibatis的jar包com.springsource.com.ibatis-2.3.0.677.jar

    Spring高版本对ibatis的支持

    <bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean"> <value>classpath:SqlMapConfig.xml <bean id="dao" class="org.springframework.orm.ibatis....

    IBATISJDBC包

    "IBATISJDBC包"指的是包含了用于支持IBATIS框架运行所需的JDBC(Java Database Connectivity)驱动及相关依赖的集合。在MYECLIPSE这样的集成开发环境中,这些JAR包是必不可少的,因为它们使得开发者能够无缝地将...

    ibatis、mybatis官方教程文档集合(含Manning.iBATIS.in.Action)

    Manning.iBATIS.in.Action.Jan.2007.eBook-BBL.pdf MyBatis 3 User Guide Simplified Chinese.pdf MyBatis-3.0.3-Migrations.pdf MyBatis-3.0.3-User-Guide.pdf MyBatis-3-Migrations.doc MyBatis-3-Migrations.pdf ...

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

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

    iBatis2学习笔记

    1.iBatis2学习笔记:基本原理和配置.doc 2.iBatis2学习笔记:与Spring2的整合.doc 3.iBatis2学习笔记:单表映射 .doc 4.iBatis2学习笔记:SqlMap的配置总结(18条).doc 5.iBatis2学习笔记:入参和返回值的问题.doc ...

    记一次Ibatis的意外发生.docx

    nested exception is com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'。这种错误是由于SqlMapConfig.xml文件的配置...

    mybatis源码中文注释.zip

    org.apache.ibatis.logging.jdbc org.apache.ibatis.logging.jdk14 org.apache.ibatis.logging.log4j org.apache.ibatis.logging.log4j2 org.apache.ibatis.logging.nologging org.apache.ibatis.logging.slf4j org....

    mybaits refid patch

    Caused By: org.apache.ibatis.builder.BuilderException: Could not find SQL statement to include with refid 'SAD02.SAD02_COL' at org.apache.ibatis.builder.xml.XMLStatementBuilder$IncludeNodeHandler....

    ibatis-common包

    ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包ibatis-common包

    manning.ibatis.in.action.jan.2007.rar

    《iBATIS in Action》是Manning出版社于2007年1月出版的一本专业书籍,主要聚焦于Java开发中的持久层框架iBATIS。这本书深入浅出地介绍了如何在实际项目中有效地使用iBATIS,从而提高开发效率和代码质量。iBATIS作为...

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

    所谓“半自动化”,可能理解上有点生涩。纵观目前主流的 ORM(对象关系映射),无论 ...程序员甚至不需要对 SQL 的熟练掌握,Hibernate/OJB 会根据制定的存储逻辑,自动生成对应的 SQL 并调用 JDBC 接口加以执行。

Global site tag (gtag.js) - Google Analytics