Error when calling a stored procedure

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Error when calling a stored procedure

Carlos Quintero

Hi everyone, I´m new in this group but I´m an old myBatis Framework user. I have a web-service build with spring-ws and deployed as a war file in a weblogic cluster (It´s made up of 2 servers). When the web service deployed in the second server, tries to call a stored procedure, I got a null pointer exception, when myBatis performs handling in output parameters. This behavior is ONLY happen in the second server; in the first server of the cluster, this situation does not happen, otherwise, when the web service, call to the same stored procedure, it´s performs without null pointer exceptions, and everything is fine. I need to know is someone here has had a similar situation, and what can I do for resolve this issue.

 

The DBMS is Oracle 12c, the stored procedure that I reefer, have 3 parameters, the jdbc type of these parameters are 2 REC (oracle.sql.STRUCT) and 1 Array (Array< oracle.sql.STRUCT >), the array is the output parameter.

I build a generic handler api, for mapping oracle types, and as I mentioned earlier, I don’t have any problems when this api run on the first server of the weblogic cluster.

 

The spring and myBatis libraries: spring-3.2.2, mybatis-spring 1.2.1 and mybatis 3.2.1

The connection type is a XA Data Source service provided by WebLogic.

 

The output log on the first server:

 

2020-01-30 09:41:45 DEBUG SpringManagedTransaction:88 - <JDBC Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-10, oracle.jdbc.driver.LogicalConnection@7352e00c]] will not be managed by Spring>

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <ooo Using Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-10, oracle.jdbc.driver.LogicalConnection@7352e00c]]>

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <==>  Preparing: { call PKG_TXN_UTIL.P_TXN_PPORT_GET ( ?, ?, ? ) } >

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <==> Parameters: oracle.sql.STRUCT@31a12f5f(STRUCT), oracle.sql.STRUCT@4d2d1f6d(STRUCT)>

2020-01-30 09:41:45 DEBUG SqlSessionUtils:173 - <Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29e039e2]>

2020-01-30 09:41:45 DEBUG DataSourceUtils:327 - <Returning JDBC Connection to DataSource>

 

 

 The output log on the second server:

 

2019-12-06 22:49:17 DEBUG SpringManagedTransaction:88 - <JDBC Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-1382, oracle.jdbc.driver.LogicalConnection@114f2eeb]] will not be managed by Spring>

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <ooo Using Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-1382, oracle.jdbc.driver.LogicalConnection@114f2eeb]]>

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <==>  Preparing: { call PKG_TXN_UTIL.P_TXN_PPORT_GET ( ?, ?, ? ) } >

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <==> Parameters: oracle.sql.STRUCT@164d8f78(STRUCT), oracle.sql.STRUCT@164d99d3(STRUCT)>

2019-12-06 22:49:17 DEBUG SqlSessionUtils:173 - <Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@164c793e]>

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in acp/sp/service/evalfreepratiq/model/plsql/mappers/SpEvalFreePratiqMapper.xml

### The error may involve acp.sp.service.evalfreepratiq.model.plsql.mappers.SpEvalFreePratiqMapper.GetTxnPortsProc-Inline

### The error occurred while setting parameters

### SQL: {          call PKG_TXN_UTIL.P_TXN_PPORT_GET          (         ?,        ?,        ?           )         }

### Cause: java.lang.NullPointerException

       at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)

       at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:368)

       at com.sun.proxy.$Proxy232.selectOne(Unknown Source)

       at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

       at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)

       at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)

       at com.sun.proxy.$Proxy238.GetTxnPortsProc(Unknown Source)

       at acp.sp.service.evalfreepratiq.business.impl.EvalFreePratiqImpl.evualuationFreePratique(EvalFreePratiqImpl.java:169)

       at acp.sp.service.implementation.GetSPCustomSqlQueriesServiceImpl.EvalFreePratiqueService(GetSPCustomSqlQueriesServiceImpl.java:181)

       at sun.reflect.GeneratedMethodAccessor6858.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

       …… org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)

       at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)

       at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)

       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)

       at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

       at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

       at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

       at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)

       at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)

       at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)

       at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)

       at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)

       at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)

       at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)

       at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)

       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)

       at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

       at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

       at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)

       at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)

       at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)

       at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

       at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Caused by: org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in acp/sp/service/evalfreepratiq/model/plsql/mappers/SpEvalFreePratiqMapper.xml

### The error may involve acp.sp.service.evalfreepratiq.model.plsql.mappers.SpEvalFreePratiqMapper.GetTxnPortsProc-Inline

### The error occurred while setting parameters

### SQL: {          call PKG_TXN_UTIL.P_TXN_PPORT_GET          (         ?,        ?,        ?           )         }

### Cause: java.lang.NullPointerException

       at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62)

       at sun.reflect.GeneratedMethodAccessor1470.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

       ... 63 more

Caused by: java.lang.NullPointerException

       at com.llh.util.UtilForModelPersitence.mapingResultStructRec(UtilForModelPersitence.java:654)

       at com.llh.TypeHandler.GenericHandler.getResult(GenericHandler.java:96)

       at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParameters(FastResultSetHandler.java:111)

       at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:65)

       at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)

       at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57)

       at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)

       at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)

       at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)

       at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)

       ... 69 more

 

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error when calling a stored procedure

Iwao AVE!
Hello Carlos,

The following code threw the NullPointerException (line 654 of UtilForModelPersitence.java).
Once you figure out what became null and why, it would be easier to make a guess about why it does not happen on the first server.

> com.llh.util.UtilForModelPersitence.mapingResultStructRec(UtilForModelPersitence.java:654)

If you need further assistance, please post the mapingResultStructRec method with line 654 highlighted.

Hope this helps,
Iwao

On Fri, Jan 31, 2020 at 12:51 AM Carlos Quintero <[hidden email]> wrote:

Hi everyone, I´m new in this group but I´m an old myBatis Framework user. I have a web-service build with spring-ws and deployed as a war file in a weblogic cluster (It´s made up of 2 servers). When the web service deployed in the second server, tries to call a stored procedure, I got a null pointer exception, when myBatis performs handling in output parameters. This behavior is ONLY happen in the second server; in the first server of the cluster, this situation does not happen, otherwise, when the web service, call to the same stored procedure, it´s performs without null pointer exceptions, and everything is fine. I need to know is someone here has had a similar situation, and what can I do for resolve this issue.

 

The DBMS is Oracle 12c, the stored procedure that I reefer, have 3 parameters, the jdbc type of these parameters are 2 REC (oracle.sql.STRUCT) and 1 Array (Array< oracle.sql.STRUCT >), the array is the output parameter.

I build a generic handler api, for mapping oracle types, and as I mentioned earlier, I don’t have any problems when this api run on the first server of the weblogic cluster.

 

The spring and myBatis libraries: spring-3.2.2, mybatis-spring 1.2.1 and mybatis 3.2.1

The connection type is a XA Data Source service provided by WebLogic.

 

The output log on the first server:

 

2020-01-30 09:41:45 DEBUG SpringManagedTransaction:88 - <JDBC Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-10, oracle.jdbc.driver.LogicalConnection@7352e00c]] will not be managed by Spring>

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <ooo Using Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-10, oracle.jdbc.driver.LogicalConnection@7352e00c]]>

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <==>  Preparing: { call PKG_TXN_UTIL.P_TXN_PPORT_GET ( ?, ?, ? ) } >

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <==> Parameters: oracle.sql.STRUCT@31a12f5f(STRUCT), oracle.sql.STRUCT@4d2d1f6d(STRUCT)>

2020-01-30 09:41:45 DEBUG SqlSessionUtils:173 - <Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29e039e2]>

2020-01-30 09:41:45 DEBUG DataSourceUtils:327 - <Returning JDBC Connection to DataSource>

 

 

 The output log on the second server:

 

2019-12-06 22:49:17 DEBUG SpringManagedTransaction:88 - <JDBC Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-1382, oracle.jdbc.driver.LogicalConnection@114f2eeb]] will not be managed by Spring>

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <ooo Using Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-1382, oracle.jdbc.driver.LogicalConnection@114f2eeb]]>

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <==>  Preparing: { call PKG_TXN_UTIL.P_TXN_PPORT_GET ( ?, ?, ? ) } >

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <==> Parameters: oracle.sql.STRUCT@164d8f78(STRUCT), oracle.sql.STRUCT@164d99d3(STRUCT)>

2019-12-06 22:49:17 DEBUG SqlSessionUtils:173 - <Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@164c793e]>

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in acp/sp/service/evalfreepratiq/model/plsql/mappers/SpEvalFreePratiqMapper.xml

### The error may involve acp.sp.service.evalfreepratiq.model.plsql.mappers.SpEvalFreePratiqMapper.GetTxnPortsProc-Inline

### The error occurred while setting parameters

### SQL: {          call PKG_TXN_UTIL.P_TXN_PPORT_GET          (         ?,        ?,        ?           )         }

### Cause: java.lang.NullPointerException

       at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)

       at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:368)

       at com.sun.proxy.$Proxy232.selectOne(Unknown Source)

       at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

       at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)

       at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)

       at com.sun.proxy.$Proxy238.GetTxnPortsProc(Unknown Source)

       at acp.sp.service.evalfreepratiq.business.impl.EvalFreePratiqImpl.evualuationFreePratique(EvalFreePratiqImpl.java:169)

       at acp.sp.service.implementation.GetSPCustomSqlQueriesServiceImpl.EvalFreePratiqueService(GetSPCustomSqlQueriesServiceImpl.java:181)

       at sun.reflect.GeneratedMethodAccessor6858.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

       …… org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)

       at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)

       at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)

       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)

       at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

       at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

       at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

       at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)

       at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)

       at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)

       at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)

       at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)

       at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)

       at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)

       at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)

       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)

       at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

       at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

       at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)

       at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)

       at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)

       at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

       at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Caused by: org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in acp/sp/service/evalfreepratiq/model/plsql/mappers/SpEvalFreePratiqMapper.xml

### The error may involve acp.sp.service.evalfreepratiq.model.plsql.mappers.SpEvalFreePratiqMapper.GetTxnPortsProc-Inline

### The error occurred while setting parameters

### SQL: {          call PKG_TXN_UTIL.P_TXN_PPORT_GET          (         ?,        ?,        ?           )         }

### Cause: java.lang.NullPointerException

       at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62)

       at sun.reflect.GeneratedMethodAccessor1470.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

       ... 63 more

Caused by: java.lang.NullPointerException

       at com.llh.util.UtilForModelPersitence.mapingResultStructRec(UtilForModelPersitence.java:654)

       at com.llh.TypeHandler.GenericHandler.getResult(GenericHandler.java:96)

       at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParameters(FastResultSetHandler.java:111)

       at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:65)

       at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)

       at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57)

       at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)

       at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)

       at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)

       at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)

       ... 69 more

 

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2SYU424_1J5kxYCaZ9ny14ximP27kkaDvuzNkuvkdUG6g%40mail.gmail.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error when calling a stored procedure

Carlos Quintero
Hi I don´t think the problem is in the API that performs the handling, because the cluster is in production and pre-production environment; and I run a debug in my local environment and I get the same result as on server 1.
The line of code that fails is:

captureError.JPG



El jueves, 30 de enero de 2020, 11:54:15 (UTC-5), Iwao AVE! escribió:
Hello Carlos,

The following code threw the NullPointerException (line 654 of UtilForModelPersitence.java).
Once you figure out what became null and why, it would be easier to make a guess about why it does not happen on the first server.

> com.llh.util.UtilForModelPersitence.mapingResultStructRec(UtilForModelPersitence.java:654)

If you need further assistance, please post the mapingResultStructRec method with line 654 highlighted.

Hope this helps,
Iwao

On Fri, Jan 31, 2020 at 12:51 AM Carlos Quintero <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="aJUoi9y8FQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">slip...@...> wrote:

Hi everyone, I´m new in this group but I´m an old myBatis Framework user. I have a web-service build with spring-ws and deployed as a war file in a weblogic cluster (It´s made up of 2 servers). When the web service deployed in the second server, tries to call a stored procedure, I got a null pointer exception, when myBatis performs handling in output parameters. This behavior is ONLY happen in the second server; in the first server of the cluster, this situation does not happen, otherwise, when the web service, call to the same stored procedure, it´s performs without null pointer exceptions, and everything is fine. I need to know is someone here has had a similar situation, and what can I do for resolve this issue.

 

The DBMS is Oracle 12c, the stored procedure that I reefer, have 3 parameters, the jdbc type of these parameters are 2 REC (oracle.sql.STRUCT) and 1 Array (Array< oracle.sql.STRUCT >), the array is the output parameter.

I build a generic handler api, for mapping oracle types, and as I mentioned earlier, I don’t have any problems when this api run on the first server of the weblogic cluster.

 

The spring and myBatis libraries: spring-3.2.2, mybatis-spring 1.2.1 and mybatis 3.2.1

The connection type is a XA Data Source service provided by WebLogic.

 

The output log on the first server:

 

2020-01-30 09:41:45 DEBUG SpringManagedTransaction:88 - <JDBC Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-10, oracle.jdbc.driver.LogicalConnection@7352e00c]] will not be managed by Spring>

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <ooo Using Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-10, oracle.jdbc.driver.LogicalConnection@7352e00c]]>

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <==>  Preparing: { call PKG_TXN_UTIL.P_TXN_PPORT_GET ( ?, ?, ? ) } >

2020-01-30 09:41:45 DEBUG GetTxnPortsProc:132 - <==> Parameters: oracle.sql.STRUCT@31a12f5f(STRUCT), oracle.sql.STRUCT@4d2d1f6d(STRUCT)>

2020-01-30 09:41:45 DEBUG SqlSessionUtils:173 - <Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@29e039e2]>

2020-01-30 09:41:45 DEBUG DataSourceUtils:327 - <Returning JDBC Connection to DataSource>

 

 

 The output log on the second server:

 

2019-12-06 22:49:17 DEBUG SpringManagedTransaction:88 - <JDBC Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-1382, oracle.jdbc.driver.LogicalConnection@114f2eeb]] will not be managed by Spring>

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <ooo Using Connection [[weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection-AppSpDataSource-1382, oracle.jdbc.driver.LogicalConnection@114f2eeb]]>

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <==>  Preparing: { call PKG_TXN_UTIL.P_TXN_PPORT_GET ( ?, ?, ? ) } >

2019-12-06 22:49:17 DEBUG GetTxnPortsProc:132 - <==> Parameters: oracle.sql.STRUCT@164d8f78(STRUCT), oracle.sql.STRUCT@164d99d3(STRUCT)>

2019-12-06 22:49:17 DEBUG SqlSessionUtils:173 - <Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@164c793e]>

org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in acp/sp/service/evalfreepratiq/model/plsql/mappers/SpEvalFreePratiqMapper.xml

### The error may involve acp.sp.service.evalfreepratiq.model.plsql.mappers.SpEvalFreePratiqMapper.GetTxnPortsProc-Inline

### The error occurred while setting parameters

### SQL: {          call PKG_TXN_UTIL.P_TXN_PPORT_GET          (         ?,        ?,        ?           )         }

### Cause: java.lang.NullPointerException

       at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:75)

       at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:368)

       at com.sun.proxy.$Proxy232.selectOne(Unknown Source)

       at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:163)

       at org.apache.ibatis.binding.MapperMethod.execute(MapperMethod.java:63)

       at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:43)

       at com.sun.proxy.$Proxy238.GetTxnPortsProc(Unknown Source)

       at acp.sp.service.evalfreepratiq.business.impl.EvalFreePratiqImpl.evualuationFreePratique(EvalFreePratiqImpl.java:169)

       at acp.sp.service.implementation.GetSPCustomSqlQueriesServiceImpl.EvalFreePratiqueService(GetSPCustomSqlQueriesServiceImpl.java:181)

       at sun.reflect.GeneratedMethodAccessor6858.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)

       at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)

       …… org.springframework.ws.transport.support.WebServiceMessageReceiverObjectSupport.handleConnection(WebServiceMessageReceiverObjectSupport.java:89)

       at org.springframework.ws.transport.http.WebServiceMessageReceiverHandlerAdapter.handle(WebServiceMessageReceiverHandlerAdapter.java:61)

       at org.springframework.ws.transport.http.MessageDispatcherServlet.doService(MessageDispatcherServlet.java:293)

       at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)

       at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)

       at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)

       at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

       at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)

       at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)

       at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:301)

       at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)

       at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:324)

       at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:460)

       at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)

       at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)

       at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:163)

       at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:60)

       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3748)

       at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3714)

       at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)

       at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)

       at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2283)

       at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2182)

       at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1491)

       at weblogic.work.ExecuteThread.execute(ExecuteThread.java:256)

       at weblogic.work.ExecuteThread.run(ExecuteThread.java:221)

Caused by: org.apache.ibatis.exceptions.PersistenceException:

### Error querying database.  Cause: java.lang.NullPointerException

### The error may exist in acp/sp/service/evalfreepratiq/model/plsql/mappers/SpEvalFreePratiqMapper.xml

### The error may involve acp.sp.service.evalfreepratiq.model.plsql.mappers.SpEvalFreePratiqMapper.GetTxnPortsProc-Inline

### The error occurred while setting parameters

### SQL: {          call PKG_TXN_UTIL.P_TXN_PPORT_GET          (         ?,        ?,        ?           )         }

### Cause: java.lang.NullPointerException

       at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:23)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:107)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:98)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:62)

       at sun.reflect.GeneratedMethodAccessor1470.invoke(Unknown Source)

       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

       at java.lang.reflect.Method.invoke(Method.java:597)

       at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:358)

       ... 63 more

Caused by: java.lang.NullPointerException

       at com.llh.util.UtilForModelPersitence.mapingResultStructRec(UtilForModelPersitence.java:654)

       at com.llh.TypeHandler.GenericHandler.getResult(GenericHandler.java:96)

       at org.apache.ibatis.executor.resultset.FastResultSetHandler.handleOutputParameters(FastResultSetHandler.java:111)

       at org.apache.ibatis.executor.statement.CallableStatementHandler.query(CallableStatementHandler.java:65)

       at org.apache.ibatis.executor.statement.RoutingStatementHandler.query(RoutingStatementHandler.java:70)

       at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:57)

       at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:259)

       at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:132)

       at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:105)

       at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:81)

       at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:104)

       ... 69 more

 

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="aJUoi9y8FQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">mybati...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/f5ec138f-5968-4487-b33f-1f7bf6ba9cc4%40googlegroups.com.
Reply | Threaded
Open this post in threaded view
|

Re: Error when calling a stored procedure

Iwao AVE!
Apparently, methodGet was null and the original exception was swallowed.
Try adding ex.printStackTrace() above that line and see what is output.

I am not implying anything at this point.
I'm just trying to help you collect more facts. :)

Regards,
Iwao

On Fri, Jan 31, 2020 at 5:35 Carlos Quintero <[hidden email]> wrote:
Hi I don´t think the problem is in the API that performs the handling, because the cluster is in production and pre-production environment; and I run a debug in my local environment and I get the same result as on server 1.
The line of code that fails is:

--
You received this message because you are subscribed to the Google Groups "mybatis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/CA%2Buep2RN_ngtC2fEcTDbfUO4dJSLj7Hg%2Byoh%2BNFfS5cdCNazSA%40mail.gmail.com.