Error when calling a stored procedure

136 views
Skip to first unread message

Carlos Quintero

unread,
Jan 30, 2020, 10:51:41 AM1/30/20
to mybatis-user

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

 

Iwao AVE!

unread,
Jan 30, 2020, 11:54:15 AM1/30/20
to mybatis-user
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

--
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 mybatis-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mybatis-user/0b4e13f0-20f0-4ec4-99ac-ae47fce2f69a%40googlegroups.com.

Carlos Quintero

unread,
Jan 30, 2020, 3:35:39 PM1/30/20
to mybatis-user
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


To unsubscribe from this group and stop receiving emails from it, send an email to mybati...@googlegroups.com.

Iwao AVE!

unread,
Jan 30, 2020, 10:01:46 PM1/30/20
to mybatis-user
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
Reply all
Reply to author
Forward
0 new messages