This content has been marked as final.
Show 4 replies
-
1. Re: Problem with getVariable
hannes Apr 12, 2006 10:48 AM (in response to soennichsen)http://docs.jboss.com/jbpm/v3/userguide/context.html
The variable names are java.lang.String. By default, jBPM supports the following value types:
* java.lang.String
* java.lang.Boolean
* java.lang.Character
* java.lang.Float
* java.lang.Double
* java.lang.Long
* java.lang.Byte
* java.lang.Short
* java.lang.Integer
* java.util.Date
* byte[]
* java.io.Serializable
* classes that are persistable with hibernate
I guess your 'Activity' object implents none of that types. Make it serializable. -
2. Re: Problem with getVariable
soennichsen Apr 12, 2006 11:37 AM (in response to soennichsen)Found the solution for my problem:
My Activity class implemented already Serializable, but... I did not set the serialVersionUID likeprivate static final long serialVersionUID = 2175042348064562851L;
After doing so, getting the variable was not a problem ;-)
I had also problems with a ClassCastException sometimes, but setting the serialVersionUID seems to sovle this problem as well!
Regards,
Sven -
3. Re: Problem with getVariable
soennichsen Apr 12, 2006 12:32 PM (in response to soennichsen)Well, I was a little bit too quick: the problem is not solved!
When I cast the object to the correct class (Activity), I sometimes get aj[list=]ava.lang.ClassCastExceptionor
[list=]org.jbpm.JbpmException: couldn't deserialize object
Why? Strange enough, that it worked for 2 or 3 times. I've experimented with the serialVersionUID to set it to the default or the a generated value, but I didn't help me.
Here is the code for Activity (now I used serialVersionUID = 1L):/** * Container for an activity */ public class Activity implements java.io.Serializable { private static final long serialVersionUID = 1L; public boolean bApproved; public String taskId; public String processName; public String description; public String toString() { return "[Activity: bApproved=" + bApproved + "]"; } }
Regards,
Sven -
4. Re: Problem with getVariable
saviola Apr 13, 2006 3:28 AM (in response to soennichsen)Hi, Sven!
I would suggest you try serializing your Activity first and then set the serialized object throughcontextInstance.setVariable(variableName, serializedValue)
I don't know if this is convinient approach to you but it worths trying it.
Regards,
Saviola