调用存储过程代码如下:
Db.execute((connection) -> { CallableStatement cs = (CallableStatement) connection.prepareCall("call PR_addPredictionOrder(1,1440,100,1,100003)"); cs.execute(); cs.close(); return ""; });
错误代码:
[ERROR]-[Thread: XNIO-11 task-5]-[com.jfinal.core.ActionHandler.handle()]: /product/add com.jfinal.plugin.activerecord.ActiveRecordException: java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledCallableStatement cannot be cast to com.mysql.jdbc.CallableStatement at com.jfinal.plugin.activerecord.DbPro.execute(DbPro.java:734) at com.jfinal.plugin.activerecord.DbPro.execute(DbPro.java:720) at com.jfinal.plugin.activerecord.Db.execute(Db.java:513) at io.abcbtc.controller.product.PredictionController.add(PredictionController.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at com.jfinal.aop.Invocation.invoke(Invocation.java:75) at com.jfinal.validate.Validator.intercept(Validator.java:86) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jfinal.validate.Validator.intercept(Validator.java:86) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jfinal.validate.Validator.intercept(Validator.java:86) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at io.abcbtc.interceptor.SessionInterceptor.intercept(SessionInterceptor.java:26) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jfinal.ext.interceptor.SessionInViewInterceptor.intercept(SessionInViewInterceptor.java:44) at com.jfinal.aop.Invocation.invoke(Invocation.java:69) at com.jfinal.core.ActionHandler.handle(ActionHandler.java:81) at com.jfinal.core.JFinalFilter.doFilter(JFinalFilter.java:89) at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:61) at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:131) at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:84) at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) at io.undertow.servlet.handlers.ServletChain$1.handleRequest(ServletChain.java:68) at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:132) at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:57) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:46) at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:64) at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:60) at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:77) at io.undertow.security.handlers.AbstractSecurityContextAssociationHandler.handleRequest(AbstractSecurityContextAssociationHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:119) at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:292) at io.undertow.servlet.handlers.ServletInitialHandler.access$100(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:138) at io.undertow.servlet.handlers.ServletInitialHandler$2.call(ServletInitialHandler.java:135) at io.undertow.servlet.core.ServletRequestContextThreadSetupAction$1.call(ServletRequestContextThreadSetupAction.java:48) at io.undertow.servlet.core.ContextClassLoaderSetupAction$1.call(ContextClassLoaderSetupAction.java:43) at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:272) at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:81) at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:104) at io.undertow.server.Connectors.executeRootHandler(Connectors.java:364) at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:830) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: java.lang.ClassCastException: com.alibaba.druid.pool.DruidPooledCallableStatement cannot be cast to com.mysql.jdbc.CallableStatement at io.abcbtc.controller.product.PredictionController.lambda$0(PredictionController.java:74) at com.jfinal.plugin.activerecord.DbPro.execute(DbPro.java:732) ... 51 more
但是代码改成:
Db.update("call PR_addPredictionOrder(1,1440,100,1,100003)");
却是正常,请问哪里出错了?
项目:JFinal
https://www.jfinal.com/doc/5-16