In Java activity if I have Object Reference as OUT parameter - I getting "java.lang.ClassCastException".

In Java activity if I have Object Reference as OUT parameter - I getting "java.lang.ClassCastException".

book

Article ID: KB0086111

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks -
Not Applicable -

Description

Resolution:
One of the problem here could be that your Object that you are trying to get it/pass out is not Serializable.

So, in attached test case - if you see the foo2 class - it is Implementing a interface Serializable from java.io . If it does not - and if you try to pass out foo2 as Object Reference out of Java Activity then you would get below Error:

java.lang.ClassCastException: test.foo2
at com.tibco.plugin.java.JavaActivity.setValue(JavaActivity.java:449)     at com.tibco.plugin.java.JavaActivity.eval(JavaActivity.java:163)     at
com.tibco.pe.core.Task.eval(Unknown Source)     at
com.tibco.pe.core.Job.a(Unknown Source)     at
com.tibco.pe.core.Job.if(Unknown Source)     at com.tibco.pe.core.JobDispatcher$a.a(Unknown Source)     at com.tibco.pe.core.JobDispatcher$a.run(Unknown Source)

So, if you are seeing this Error in your java Activity output - then make sure your object is Serializable.

Test Case ( Dat file ) , jar file and Java Code is attached .

Issue/Introduction

In Java activity if I have Object Reference as OUT parameter - I getting "java.lang.ClassCastException".