工作流脚本执行错误
金蝶云社区-云社区用户76C21234
云社区用户76C21234
0人赞赏了该文章 1,588次浏览 未经作者许可,禁止转载编辑于2016年06月15日 12:40:23

工作流中设置了脚本:
java . lang . StringBuffer Sql = new java . lang . StringBuffer ( ) ;
Sql . append ( "update T_BC_BizAccountBill set FState = 20 where fid = '" + id + "'" ) ;
java . sql . Connection con = com . kingdee . bos . framework . ejb . EJBFactory . getConnection ( __bosContext ) ;
java . sql . Statement batchStatement = con . createStatement ( ) ;
java . sql . ResultSet prst = batchStatement . executeQuery ( Sql . toString ( ) ) ;
com . kingdee . util . db . SQLUtils . cleanup ( batchStatement , con ) ;

但是工作流执行到该脚本时,流程就挂起了。报错信息请见下面,谢谢!

------
Caused by: com.kingdee.bos.workflow.WfException :
执行脚本活动【脚本11】时发生错误. 错误信息:
Caused by: com.kingdee.bos.workflow.WfException :
执行脚本时发生错误,脚本:java . lang . StringBuffer Sql = new java . lang . StringBuffer ( ) ;
Sql . append ( "update T_BC_BizAccountBill set FState = 20 where fid = '" + id + "'" ) ;
java . sql . Connection con = com . kingdee . bos . framework . ejb . EJBFactory . getConnection ( __bosContext ) ;
java . sql . Statement batchStatement = con . createStatement ( ) ;
java . sql . ResultSet prst = batchStatement . executeQuery ( Sql . toString ( ) ) ;
com . kingdee . util . db . SQLUtils . cleanup ( batchStatement , con ) ;
Caused by: com.kingdee.bos.kscript.runtime.InterpreterException :
第5行执行出错:
java . sql . ResultSet prst = batchStatement . executeQuery ( Sql . toString ( ) ) ;
执行方法错误,JAVA方法抛出异常.对象: com.apusic.jdbc.adapter.StatementHandle@56ddddef, 方法: executeQuery, 参数表: [Ljava.lang.Object;@f0d98dd1, 上下文环境: Context:=null, 错误信息: null
异常内码EXEC_METHOD_INVOCATIONTARGET
异常类型:执行错误
子系统:KSCRIPT
null
JAVA方法抛出时抛出异常
建议解决办法:
请检查上下文环境及JAVA代码
Caused by: java.lang.reflect.InvocationTargetException :
java.sql.SQLException: The executeQuery method must return a result set.
at net.sourceforge.jtds.jdbc.JtdsStatement.executeSQLQuery(JtdsStatement.java:517)
at net.sourceforge.jtds.jdbc.JtdsStatement.executeQuery(JtdsStatement.java:1433)
at com.kingdee.bos.sql.shell.KDStatement.executeQuery(KDStatement.java:637)
at com.apusic.jdbc.adapter.StatementHandle.executeQuery(StatementHandle.java:89)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:94)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at com.kingdee.bos.kscript.runtime.KScriptUtil.evalJavaMethod(KScriptUtil.java:304)
at com.kingdee.bos.kscript.runtime.Interpreter.invokeMethod(Interpreter.java:2540)
at com.kingdee.bos.kscript.runtime.Interpreter.invokMethod(Interpreter.java:2519)
at com.kingdee.bos.kscript.runtime.Interpreter.evalMethodInvokeExpr(Interpreter.java:2392)
at com.kingdee.bos.kscript.runtime.Interpreter.evalExprInternal(Interpreter.java:1313)
at com.kingdee.bos.kscript.runtime.Interpreter.evalBlockStmtList(Interpreter.java:708)
at com.kingdee.bos.kscript.runtime.Interpreter.eval(Interpreter.java:499)
at com.kingdee.bos.kscript.runtime.Interpreter.eval(Interpreter.java:460)
at com.kingdee.bos.workflow.util.ScriptUtil.executeScriptReturnValue(ScriptUtil.java:247)
at com.kingdee.bos.workflow.util.ScriptUtil.executeScript(ScriptUtil.java:266)
at com.kingdee.bos.workflow.enactment.app.DefaultApplicationManager.invokeScript(DefaultApplicationManager.java:790)
at com.kingdee.bos.workflow.enactment.app.DefaultApplicationManager.invokeApplication(DefaultApplicationManager.java:344)
at com.kingdee.bos.workflow.enactment.ToolActivityRunner.invoke(ToolActivityRunner.java:149)
at com.kingdee.bos.workflow.engine.app.ToolActivityInvoker.invoke(ToolActivityInvoker.java:40)
at com.kingdee.cbos.process.vm.internal.i.wrapper.ApplicationWrapper.invoke(ApplicationWrapper.java:39)
at com.kingdee.cbos.process.vm.internal.r.ExecutionImpl.execute(ExecutionImpl.java:719)
at com.kingdee.cbos.process.vm.internal.r.ControllerImpl.execute(ControllerImpl.java:72)
at com.kingdee.cbos.process.vm.internal.r.ControllerImpl.execute(ControllerImpl.java:58)
at com.kingdee.cbos.process.vm.internal.r.ControllerImpl.execute(ControllerImpl.java:33)
at com.kingdee.cbos.process.vm.internal.r.FlowContextImpl.resume(FlowContextImpl.java:591)
at com.kingdee.bos.workflow.engine.core.thread.FlowResume.resume(FlowResume.java:107)
at com.kingdee.bos.workflow.engine.core.thread.FlowResume.execute(FlowResume.java:88)
at com.kingdee.bos.workflow.engine.core.thread.WfJobHandler.handler(WfJobHandler.java:194)
at sun.reflect.GeneratedMethodAccessor370.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at com.kingdee.bos.workflow.util.InvocationExecutor.execute(InvocationExecutor.java:28)
at com.kingdee.bos.workflow.transaction.WfTxInvoker.invoke(WfTxInvoker.java:33)
at sun.reflect.GeneratedMethodAccessor334.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at com.kingdee.bos.workflow.metas.InvokeMethodDelegateControllerBean.invoke(InvokeMethodDelegateControllerBean.java:77)
at com.kingdee.bos.workflow.metas.InvokeMethodDelegateControllerBean._invokeRequired(InvokeMethodDelegateControllerBean.java:31)
at com.kingdee.bos.workflow.metas.AbstractInvokeMethodDelegateControllerBean.invokeRequired(AbstractInvokeMethodDelegateControllerBean.java:46)
at sun.reflect.GeneratedMethodAccessor344.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at com.kingdee.bos.transaction.EJBTxFacade.TxInvokerBean.invoke(TxInvokerBean.java:125)
at com.kingdee.bos.transaction.EJBTxFacade.TxInvokerBean.INVOKE_REQUIRED(TxInvokerBean.java:60)
at com.kingdee.bos.transaction.EJBTxFacade.TxInvokerBean_LocalObjectImpl_2.INVOKE_REQUIRED(Unknown Source)
at com.kingdee.bos.transaction.EJBTransactionProxy.invoke(EJBTransactionProxy.java:171)
at com.kingdee.bos.transaction.EJBTransactionProxy.invoke(EJBTransactionProxy.java:324)
at com.sun.proxy.$Proxy254.invokeRequired(Unknown Source)
at com.kingdee.bos.workflow.metas.InvokeMethodDelegate.invokeRequired(InvokeMethodDelegate.java:61)
at sun.reflect.GeneratedMethodAccessor343.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
at java.lang.reflect.Method.invoke(Method.java:619)
at com.kingdee.bos.ResponseInvocationHandler.invoke(ResponseInvocationHandler.java:194)
at com.sun.proxy.$Proxy253.invokeRequired(Unknown Source)
at com.kingdee.bos.workflow.transaction.WfTxHelper.invokeRequired(WfTxHelper.java:83)
at com.kingdee.bos.workflow.engine.core.thread.WfJobHandler.invoke(WfJobHandler.java:78)
at com.kingdee.bos.workflow.engine.core.thread.WfJobHandler.invoke(WfJobHandler.java:182)
at com.kingdee.bos.workflow.engine.core.thread.WfJobHandler.execute(WfJobHandler.java:101)
at com.kingdee.bos.service.job.core.ThreadWorker.execute(ThreadWorker.java:161)
at com.kingdee.bos.service.job.core.ThreadWorker.run(ThreadWorker.java:106)
at java.lang.Thread.run(Thread.java:853)
------