[JBoss jBPM] - NullPointerException after signal token in Process State wit
by kirq4e
Hi guys,
Recently me and my colleague started learning jBPM for our new project. I have started creating some processes to learn its capabilities.
We have developed a simple Parent-Children scenario.
The parent process is:
<?xml version="1.0" encoding="UTF-8"?>
| <process-definition xmlns="" name="ParentProcess">
| <start-state name="start">
| <transition to="SetInputVariable" name="toSetInputVariable"></transition>
| </start-state>
|
| <process-state name="InvokeChildProcess">
| <sub-process name="ChildProcess" binding="late"></sub-process>
| <variable access="read" name="parentKey"></variable>
| <variable access="read,write" name="lastVisitedProcess"></variable>
| <transition to="PrintVariables" name="toPrintVariables"></transition>
| </process-state>
|
| <node name="SetInputVariable">
| <action class="com.sirma.ecs2.test.subprocess.actions.SetInputVariables"></action>
| <transition to="InvokeChildProcess" name="toInvokeChildProcess"></transition>
| </node>
|
| <node name="PrintVariables">
| <action class="com.sirma.ecs2.test.subprocess.actions.PrintVariables"></action>
| <transition to="end" name="toEnd"></transition>
| </node>
| <end-state name="end"></end-state>
| </process-definition>
The child process is:
<?xml version="1.0" encoding="UTF-8"?>
| <process-definition xmlns="" name="ChildProcess">
| <start-state name="start">
| <transition to="Reset Variables" name="toResetVariables"></transition>
| </start-state>
|
| <node name="Reset Variables">
| <action name="Reset Variables" class="com.sirma.ecs2.test.subprocess.actions.ResetVariables"></action>
| <transition to="WaitSignal" name="toWaitSignal"></transition>
| </node>
|
| <state name="WaitSignal">
| <transition to="end" name="toEnd">
| <action class="com.sirma.ecs2.test.subprocess.actions.ExitWait"></action>
| </transition>
| </state>
| <end-state name="end"></end-state>
| </process-definition>
I start a Parent process and signal it the Token stops at the child`s State node: WaitSignal.
The Root token of the parent node is in InvokeChildProcess. The ActionHandlers are very simple just print a message and work with some variables.
If i try to signal the Parent process`s root node i got a NullPointerException:
Caused by: java.lang.NullPointerException
| at org.jbpm.graph.node.ProcessState.leave(ProcessState.java:186)
| 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:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.def.Node_$$_javassist_49.leave(Node_$$_javassist_49.java)
| at org.jbpm.graph.exe.Token.signal(Token.java:192)
| at org.jbpm.graph.exe.Token.signal(Token.java:140)
| 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:585)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
| at org.jbpm.graph.exe.Token_$$_javassist_64.signal(Token_$$_javassist_64.java)
| at com.kpenev.test.TestBean.signalToken(Unknown Source)
|
Probably the right token that i have to signal is the token of the subprocess, but i don`t think that such an exception should occur.
The code that i execute is:
JbpmContext jbpmContext = JbpmConfiguration.getInstance()
| .createJbpmContext();
| try {
| ProcessInstance instance = jbpmContext.getGraphSession()
| .loadProcessInstance(instanceID);
| instance.getRootToken().signal();
| } finally {
| jbpmContext.close();
| }
The code that really works is:
JbpmContext jbpmContext = JbpmConfiguration.getInstance()
| .createJbpmContext();
| try {
| ProcessInstance instance = jbpmContext.getGraphSession()
| .loadProcessInstance(instanceID);
| instance.getRootToken().getSubProcessInstance().getRootToken()
| .signal();
| } finally {
| jbpmContext.close();
| }
I`m using jbpm-3.3.0.GA version and jboss-4.2.3.GA.
I debuged it and the subProcessInstance variable at ExecutionContext isn`t set.
Hope there is a solution for this, because in the near future i have to develop a very complex processes including subprocesses.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4200781#4200781
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4200781
17 years, 3 months
[EJB/JBoss] - How to call oracle function from ejb3
by zzuli
Hi,everyoneï¼
i'm trying to call an oracle query-function returning a result-set from ejb3.
The oracle function:
create or replace FUNCTION getSecThreadCount(secId in NUMBER,avai in NUMBER)
RETURN SYS_REFCURSOR is cur SYS_REFCURSOR;
m_sql VARCHAR2(250);
BEGIN
m_sql:='select count(thrId) from thread where secId='|| secid||'
and thrAvai='|| avai;
open cur for m_sql;
return cur;
END;
I'v tried several ways to call it,but all failed:
the calling code:
public Object getSectionThreadCount(int secId,int avai){
Query query=manager.createNativeQuery("{call getSecThreadCount(?,?) }");
query.setParameter(1, secId);
query.setParameter(2, avai);
return query.getSingleResult();
}
but i got the exception:
Exception in thread "main" javax.ejb.EJBException: javax.persistence.PersistenceException:
org.hibernate.exception.SQLGrammarException: could not execute query; nested exception is:
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute
query
javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute
query
....
Caused by: java.sql.SQLException: ORA-06550: row 1, col 7:
PLS-00221: 'GETSECTHREADCOUNT' not procedure or not defined
ORA-06550: row 1, col 7:
PL/SQL: Statement ignored
i have tried several other ways of writing query:
" createNativeQuery("{ ?=call getSecThreadCount(?,?) }") " //hibernate using this way
" createNativeQuery("select getSecThreadCount(?,?) from dual") "
but all failed.
i have successfully called the function from hibernate.
and i have successfully called a mysql query-stored-procedure which returns a result-set using the
same code; also it's ok to call an oracle function which returns an int using the code
" entityManager.createNativeQuery("SELECT sum_total(?1) FROM DUAL") " from ejb3.
so, i believe it's totally possible to get the result-set of oracle function or SP using ejb3.
but i cannot figured out the right way.
i use oracle11g, jboss5GA.
could anyone help me? thanks a lot.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4200780#4200780
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4200780
17 years, 3 months