ibatis执行存储过程,java.lang.ArrayIndexOutOfBoundsException: 0
2017-04-17 15:00
369 查看
在项目开发中遇到一个问题,ibatis执行存储过程时报错
<procedure id="insertStatisticsResult_settle" parameterClass="String">
<![CDATA[
{call proc_stats_$statisticsType$()}
]]>
</procedure>
错误日志如下:
在网上查了资料没有有效的解决方案,所以只能跟踪日志来。
观察这个日志是由于传入参数错误,我看网上demo都是传入的map,而我的是string,
问题出在这,存储过程参数都以map的形式传入。
将传入参数改为hashmap就ok了
<procedure id="insertStatisticsResult_settle" parameterClass="java.util.HashMap">
<![CDATA[
{call proc_stats_$statisticsType$()}
]]>
</procedure>
<procedure id="insertStatisticsResult_settle" parameterClass="String">
<![CDATA[
{call proc_stats_$statisticsType$()}
]]>
</procedure>
错误日志如下:
--- The error occurred in com/aspire/prm/dmplt/statistics/dao/ibatis/maps/StatisticsSQL.xml. --- The error occurred while applying a parameter map. --- Check the insertStatisticsResult_settle-InlineParameterMap. --- Check the output parameters. --- Cause: java.lang.ArrayIndexOutOfBoundsException: 0; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/aspire/prm/dmplt/statistics/dao/ibatis/maps/StatisticsSQL.xml. --- The error occurred while applying a parameter map. --- Check the insertStatisticsResult_settle-InlineParameterMap. --- Check the output parameters. --- Cause: java.lang.ArrayIndexOutOfBoundsException: 0 Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in com/aspire/prm/dmplt/statistics/dao/ibatis/maps/StatisticsSQL.xml. --- The error occurred while applying a parameter map. --- Check the insertStatisticsResult_settle-InlineParameterMap. --- Check the output parameters. --- Cause: java.lang.ArrayIndexOutOfBoundsException: 0 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:94) at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:447) at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82) at org.springframework.orm.ibatis.SqlMapClientTemplate$9.doInSqlMapClient(SqlMapClientTemplate.java:370) at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) at org.springframework.orm.ibatis.SqlMapClientTemplate.insert(SqlMapClientTemplate.java:368) at com.aspire.prm.dmplt.statistics.dao.ibatis.StatisticsDaoImpl.doStatistics(StatisticsDaoImpl.java:63) at com.aspire.prm.dmplt.statistics.biz.impl.StatisticsBizImpl.doStatistics(StatisticsBizImpl.java:64) at com.aspire.prm.app.statistics.manager.impl.StatisticsManagerImpl.doStatistics(StatisticsManagerImpl.java:62) at com.aspire.prm.app.statistics.manager.impl.StatisticsManagerImpl.doStatistics(StatisticsManagerImpl.java:50) at com.aspire.prm.app.statistics.manager.impl.StatisticsManagerImpl$$FastClassByCGLIB$$c1412355.invoke(<generated>) at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149) at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696) 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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631) at com.aspire.prm.app.statistics.manager.impl.StatisticsManagerImpl$$EnhancerByCGLIB$$7f8146a6.doStatistics(<generated>) at com.aspire.prm.app.statistics.job.StatisticsJob.execute(StatisticsJob.java:40) at org.quartz.core.JobRunShell.run(JobRunShell.java:202) at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529) Caused by: java.lang.ArrayIndexOutOfBoundsException: 0 at com.ibatis.sqlmap.engine.exchange.PrimitiveDataExchange.setData(PrimitiveDataExchange.java:51) at com.ibatis.sqlmap.engine.mapping.parameter.BasicParameterMap.refreshParameterObjectValues(BasicParameterMap.java:140) at com.ibatis.sqlmap.engine.mapping.statement.ProcedureStatement.postProcessParameterObject(ProcedureStatement.java:26) at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeUpdate(GeneralStatement.java:82) ... 22 more
在网上查了资料没有有效的解决方案,所以只能跟踪日志来。
--- The error occurred while applying a parameter map. --- Check the insertStatisticsResult_settle-InlineParameterMap.
观察这个日志是由于传入参数错误,我看网上demo都是传入的map,而我的是string,
问题出在这,存储过程参数都以map的形式传入。
将传入参数改为hashmap就ok了
<procedure id="insertStatisticsResult_settle" parameterClass="java.util.HashMap">
<![CDATA[
{call proc_stats_$statisticsType$()}
]]>
</procedure>
相关文章推荐
- java.lang.ArrayIndexOutOfBoundsException异常分析及解决
- java.lang.ArrayIndexOutOfBoundsException异常分析及解决
- java.lang.ArrayIndexOutOfBoundsException
- hadoop报错: java.lang.ArrayIndexOutOfBoundsException
- 较少遇到的错误—严重: StandardWrapper.Throwable—java.lang.ArrayIndexOutOfBoundsException: 48188
- 使用JXL生成Excel时发生java.lang.ArrayIndexOutOfBoundsException错误
- java.lang.ArrayIndexOutOfBoundsException: 3184
- java.lang.ArrayIndexOutOfBoundsException: 0错误
- SessionFactoryImpl.get错误:java.lang.ArrayIndexOutOfBoundsException: -68问题
- java.lang.ArrayIndexOutOfBoundsException
- Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
- java java.lang.ArrayIndexOutOfBoundsException: 1
- jxl 错误 java.lang.ArrayIndexOutOfBoundsException: 441
- java 中 java.lang.ArrayIndexOutOfBoundsException: 0 异常
- jxl导出excel异常:java.lang.ArrayIndexOutOfBoundsException: 31
- Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0
- WAS下使用OJDBC14.JAR的JAVA.LANG.ARRAYINDEXOUTOFBOUNDSEXCEPTION问题
- 如何解决在快速向jtable添加数据的时候报AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException:异常
- AXMLPrinter2.jar反编译xml文件时 java.lang.ArrayIndexOutOfBoundsException错误
- [经验小结]jxl写excel时产生“java.lang.ArrayIndexOutOfBoundsException: 5”问题的解决办法