[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12721031#action_12721031 ] LindsayW commented on IBATIS-464: - hi, the problem i posted was caused by only replacing ibatis-sqlmap-2.jar and simply solved by replacing "3" jar files(ibatis-sqlmap-2.jar , iabtis-dao-2.jar and iabtis-common-2.jar) with iabtis-2.3.0.676 thanks anyway > iBatis throws a NPE when performing a sub-select in a resultMap. > > > Key: IBATIS-464 > URL: https://issues.apache.org/jira/browse/IBATIS-464 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps >Affects Versions: 2.2.0, 2.3.0 > Environment: WinXP, Java 1.5, originally discovered when moving to > Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0) >Reporter: Mitchell L. Waters III >Priority: Blocker > > iBatis throws a NullPointerException when performing a sub-select in a > resultMap. > For some foo record in the DB, there are a variable number of comments. > iBatis allows the user to return an object that contains the information from > the foo table and return the list/array/collection of related items (comments > in this example) from a separate table that relate to the foo record, using a > resultMap like what is listed below. > > > >/> > > This works without a hitch in iBatis 2.1.7. However when you attempt to do > the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). > Digging in a bit, it seems that the session returned to do the SessionScope > that is returned for the sub-select is different than that used to run the > original select (different than the behavior in 2.1.7) and that the > transaction/transaction manager for the new SessionScope object is null. It > ends up throwing when it attempts to start a new transaction for the > sub-select. > I originally saw this problem when updating my application to use Spring > 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), > but upon further investigation I was able to isolate it to being in the > ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with > an older version (2.1.7) of iBatis, and this works fine. While testing the > problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and > 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0. > Hopefully, this will be fixed but until then we will be sticking with 2.1.7. > Thank you, > Mitch Waters > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; > uncategorized SQLException for SQL []; SQL state [null]; error code [0]; > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) > at > org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:261) > at dbtest.UserDao.queryForList(UserDao.java:23) > at dbtest.UserDao.complexQuery(UserDao.java:14) > at db
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12710452#action_12710452 ] Kai Grabfelder commented on IBATIS-464: --- Please provide the complete stacktrace. I don't see an iBATIS class in the cause of your stacktrace. > iBatis throws a NPE when performing a sub-select in a resultMap. > > > Key: IBATIS-464 > URL: https://issues.apache.org/jira/browse/IBATIS-464 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps >Affects Versions: 2.2.0, 2.3.0 > Environment: WinXP, Java 1.5, originally discovered when moving to > Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0) >Reporter: Mitchell L. Waters III >Priority: Blocker > > iBatis throws a NullPointerException when performing a sub-select in a > resultMap. > For some foo record in the DB, there are a variable number of comments. > iBatis allows the user to return an object that contains the information from > the foo table and return the list/array/collection of related items (comments > in this example) from a separate table that relate to the foo record, using a > resultMap like what is listed below. > > > >/> > > This works without a hitch in iBatis 2.1.7. However when you attempt to do > the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). > Digging in a bit, it seems that the session returned to do the SessionScope > that is returned for the sub-select is different than that used to run the > original select (different than the behavior in 2.1.7) and that the > transaction/transaction manager for the new SessionScope object is null. It > ends up throwing when it attempts to start a new transaction for the > sub-select. > I originally saw this problem when updating my application to use Spring > 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), > but upon further investigation I was able to isolate it to being in the > ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with > an older version (2.1.7) of iBatis, and this works fine. While testing the > problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and > 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0. > Hopefully, this will be fixed but until then we will be sticking with 2.1.7. > Thank you, > Mitch Waters > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; > uncategorized SQLException for SQL []; SQL state [null]; error code [0]; > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) > at > org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:261) > at dbtest.UserDao.queryForList(UserDao.java:23) > at dbtest.UserDao.complexQuery(UserDao.java:14) > at dbtest.UserDaoTest.testGetComplexUserList(UserDaoTest.java:43) > at sun.reflect.NativeMethodAccessorImpl.inv
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709682#action_12709682 ] LindsayW commented on IBATIS-464: - Thanks and apologize for having left out the log. should I set sqlMapClient1 for datasource1 , sqlMapClient2 for datasource2 , and so on? Thank you Log: com.mobile.scms.servicechange.util.ServiceChangeException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred in /SqlMap.xml. --- The error occurred while applying a result map. --- Check the SCMS.ReceiveItemListResultMap. --- Check the result mapping for the 'scmsChngWoVoList' property. --- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in /SqlMap.xml. --- The error occurred while applying a result map. --- Check the SCMS.ReceiveItemListResultMap. --- Check the result mapping for the 'scmsChngWoVoList' property. --- Cause: java.lang.NullPointerException at com.mobile.scms.servicechange.service.impl.ReceiveServiceImpl.getReceiveItemList(ReceiveServiceImpl.java:142) 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:324) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176) at $Proxy183.getReceiveItemList(Unknown Source) at com.mobile.scms.servicechange.main.action.MultipleModificationAction.getChrgTypeGExpenseListByReceiveId(MultipleModificationAction.java:2765) at com.mobile.scms.servicechange.main.action.MultipleModificationAction.submit(MultipleModificationAction.java:638) 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:324) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at com.mobile.scms.servicechange.servlet.MyActionServlet.process(MyActionServlet.java:59) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.mobile.scms.sso.web.AuthenticationFilter.doFilter(Unknown Source) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:334) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at com.mobile.scms.servicechange.servlet.MyActionServlet.process(MyActionServlet.java:59) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.s
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709676#action_12709676 ] LindsayW commented on IBATIS-464: - Thanks and apologize for having left out the log. should I set sqlMapClient1 for datasource1 , sqlMapClient2 for datasource2 , and so on? Thank you Log: com.mobile.scms.servicechange.util.ServiceChangeException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred in /SqlMap.xml. --- The error occurred while applying a result map. --- Check the SCMS.ReceiveItemListResultMap. --- Check the result mapping for the 'scmsChngWoVoList' property. --- Cause: java.lang.NullPointerException; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in /SqlMap.xml. --- The error occurred while applying a result map. --- Check the SCMS.ReceiveItemListResultMap. --- Check the result mapping for the 'scmsChngWoVoList' property. --- Cause: java.lang.NullPointerException at com.mobile.scms.servicechange.service.impl.ReceiveServiceImpl.getReceiveItemList(ReceiveServiceImpl.java:142) 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:324) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:335) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:176) at $Proxy183.getReceiveItemList(Unknown Source) at com.mobile.scms.servicechange.main.action.MultipleModificationAction.getChrgTypeGExpenseListByReceiveId(MultipleModificationAction.java:2765) at com.mobile.scms.servicechange.main.action.MultipleModificationAction.submit(MultipleModificationAction.java:638) 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:324) at org.apache.struts.actions.DispatchAction.dispatchMethod(DispatchAction.java:274) at org.apache.struts.actions.DispatchAction.execute(DispatchAction.java:194) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:419) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:224) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at com.mobile.scms.servicechange.servlet.MyActionServlet.process(MyActionServlet.java:59) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:1077) at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:465) at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:28) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at com.mobile.scms.sso.web.AuthenticationFilter.doFilter(Unknown Source) at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:27) at weblogic.servlet.internal.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:334) at org.apache.struts.action.RequestProcessor.doForward(RequestProcessor.java:1063) at org.apache.struts.action.RequestProcessor.processForwardConfig(RequestProcessor.java:386) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:229) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1194) at com.mobile.scms.servicechange.servlet.MyActionServlet.process(MyActionServlet.java:59) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.s
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709510#action_12709510 ] Kai Grabfelder commented on IBATIS-464: --- what do you mean oyu get similar error message? Please post a stacktrace. Furthermore you should use inject the datasource into the sqlmapclientfactorybean. There should be no need for you to have a datasource in your DAOs > iBatis throws a NPE when performing a sub-select in a resultMap. > > > Key: IBATIS-464 > URL: https://issues.apache.org/jira/browse/IBATIS-464 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps >Affects Versions: 2.2.0, 2.3.0 > Environment: WinXP, Java 1.5, originally discovered when moving to > Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0) >Reporter: Mitchell L. Waters III >Priority: Blocker > > iBatis throws a NullPointerException when performing a sub-select in a > resultMap. > For some foo record in the DB, there are a variable number of comments. > iBatis allows the user to return an object that contains the information from > the foo table and return the list/array/collection of related items (comments > in this example) from a separate table that relate to the foo record, using a > resultMap like what is listed below. > > > >/> > > This works without a hitch in iBatis 2.1.7. However when you attempt to do > the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). > Digging in a bit, it seems that the session returned to do the SessionScope > that is returned for the sub-select is different than that used to run the > original select (different than the behavior in 2.1.7) and that the > transaction/transaction manager for the new SessionScope object is null. It > ends up throwing when it attempts to start a new transaction for the > sub-select. > I originally saw this problem when updating my application to use Spring > 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), > but upon further investigation I was able to isolate it to being in the > ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with > an older version (2.1.7) of iBatis, and this works fine. While testing the > problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and > 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0. > Hopefully, this will be fixed but until then we will be sticking with 2.1.7. > Thank you, > Mitch Waters > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; > uncategorized SQLException for SQL []; SQL state [null]; error code [0]; > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) > at > org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:261) > at dbtest.UserDao.queryForList(UserDao.java:23) > at dbtest.UserDao.complexQuery(UserDao.java:14) >
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12709315#action_12709315 ] LindsayWang commented on IBATIS-464: hi please give me some help i got the similar error message from upgrade ibatis 2.1.6 to 2.3.0 (spring 1.2.6) however, in my case i have many datasources ,i was wondering how to inject the datasource into the SqlMapClient only. my spring configuration is like the following: > iBatis throws a NPE when performing a sub-select in a resultMap. > > > Key: IBATIS-464 > URL: https://issues.apache.org/jira/browse/IBATIS-464 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps >Affects Versions: 2.2.0, 2.3.0 > Environment: WinXP, Java 1.5, originally discovered when moving to > Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0) >Reporter: Mitchell L. Waters III >Priority: Blocker > > iBatis throws a NullPointerException when performing a sub-select in a > resultMap. > For some foo record in the DB, there are a variable number of comments. > iBatis allows the user to return an object that contains the information from > the foo table and return the list/array/collection of related items (comments > in this example) from a separate table that relate to the foo record, using a > resultMap like what is listed below. > > > >/> > > This works without a hitch in iBatis 2.1.7. However when you attempt to do > the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). > Digging in a bit, it seems that the session returned to do the SessionScope > that is returned for the sub-select is different than that used to run the > original select (different than the behavior in 2.1.7) and that the > transaction/transaction manager for the new SessionScope object is null. It > ends up throwing when it attempts to start a new transaction for the > sub-select. > I originally saw this problem when updating my application to use Spring > 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), > but upon further investigation I was able to isolate it to being in the > ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with > an older version (2.1.7) of iBatis, and this works fine. While testing the > problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and > 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0. > Hopefully, this will be fixed but until then we will be sticking with 2.1.7. > Thank you, > Mitch Waters > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; > uncategorized SQLException for SQL []; SQL state [null]; error code [0]; > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) > at > org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:261) > at dbtest.UserDao.queryForList(UserDao.jav
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532185 ] Mitchell L. Waters III commented on IBATIS-464: --- Thanks, that fixed it for us. We were using the Spring helper classes to build our daos-- that is, our DAO extends SqlMapClientDaoSupport and we set a SqlMapClientTemplate on the DAO. So, we thought that counted as setting the datasource on the SqlMapClient -- obviously not the case, at least for ibatis2. For the record, the following change in our spring config fixed it. Change: ... classpath:/sql-map-config.xml ... to: ... classpath:/sql-map-config.xml ... > iBatis throws a NPE when performing a sub-select in a resultMap. > > > Key: IBATIS-464 > URL: https://issues.apache.org/jira/browse/IBATIS-464 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps >Affects Versions: 2.2.0, 2.3.0 > Environment: WinXP, Java 1.5, originally discovered when moving to > Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0) >Reporter: Mitchell L. Waters III >Priority: Blocker > > iBatis throws a NullPointerException when performing a sub-select in a > resultMap. > For some foo record in the DB, there are a variable number of comments. > iBatis allows the user to return an object that contains the information from > the foo table and return the list/array/collection of related items (comments > in this example) from a separate table that relate to the foo record, using a > resultMap like what is listed below. > > > >/> > > This works without a hitch in iBatis 2.1.7. However when you attempt to do > the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). > Digging in a bit, it seems that the session returned to do the SessionScope > that is returned for the sub-select is different than that used to run the > original select (different than the behavior in 2.1.7) and that the > transaction/transaction manager for the new SessionScope object is null. It > ends up throwing when it attempts to start a new transaction for the > sub-select. > I originally saw this problem when updating my application to use Spring > 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), > but upon further investigation I was able to isolate it to being in the > ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with > an older version (2.1.7) of iBatis, and this works fine. While testing the > problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and > 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0. > Hopefully, this will be fixed but until then we will be sticking with 2.1.7. > Thank you, > Mitch Waters > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; > uncategorized SQLException for SQL []; SQL state [null]; error code [0]; > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.qu
[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.
[ https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532170 ] Jeff Butler commented on IBATIS-464: I believe this is a known issue with a simple fix...In your Spring configuration, make sure that you inject the datasource into the SqlMapClient ONLY - not each DAO. Please verify that you are only injecting the datasource into the SqlMapClient only and then report back to us. > iBatis throws a NPE when performing a sub-select in a resultMap. > > > Key: IBATIS-464 > URL: https://issues.apache.org/jira/browse/IBATIS-464 > Project: iBatis for Java > Issue Type: Bug > Components: SQL Maps >Affects Versions: 2.2.0, 2.3.0 > Environment: WinXP, Java 1.5, originally discovered when moving to > Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0) >Reporter: Mitchell L. Waters III >Priority: Blocker > > iBatis throws a NullPointerException when performing a sub-select in a > resultMap. > For some foo record in the DB, there are a variable number of comments. > iBatis allows the user to return an object that contains the information from > the foo table and return the list/array/collection of related items (comments > in this example) from a separate table that relate to the foo record, using a > resultMap like what is listed below. > > > >/> > > This works without a hitch in iBatis 2.1.7. However when you attempt to do > the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). > Digging in a bit, it seems that the session returned to do the SessionScope > that is returned for the sub-select is different than that used to run the > original select (different than the behavior in 2.1.7) and that the > transaction/transaction manager for the new SessionScope object is null. It > ends up throwing when it attempts to start a new transaction for the > sub-select. > I originally saw this problem when updating my application to use Spring > 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), > but upon further investigation I was able to isolate it to being in the > ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with > an older version (2.1.7) of iBatis, and this works fine. While testing the > problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and > 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0. > Hopefully, this will be fixed but until then we will be sticking with 2.1.7. > Thank you, > Mitch Waters > org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; > uncategorized SQLException for SQL []; SQL state [null]; error code [0]; > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException; nested exception is > com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: > --- The error occurred in test.xml. > --- The error occurred while applying a result map. > --- Check the complexResult. > --- Check the result mapping for the 'roles' property. > --- Cause: java.lang.NullPointerException > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188) > at > com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615) > at > com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589) > at > com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118) > at > org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267) > at > org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:261) > at dbtest.UserDao.queryForList(UserDao.java:23) > at dbtest.UserDao.complex
