Serialization problems on RMI invocation from Oracle Application Server

Hello,

I have a web application running on Oracle 9i AS. This application communicates with a process in a different machine using RMI. I have several methods on the RMI object that return information about the process' status so I invoke these methods to publish such information through my web application.

All these methods return primitive values. Now I've added a new method that returns an Array of Hashtables. Each Hashtable in the array contains, as key elements, Bean Objects which only have primitive atributes and accessor methods. The values of the Hashtables, associated to the Bean key elements, are Strings containing text.

When I do RMI on this new method on my web app I get this error:

"error unmarshalling return; nested exception is: java.io.InvalidClassException: <qualified name of the bean class>; is not Serializable".

It says my Bean class is not serializable, although it only contains primitive values.

I have done some testing in standalone code on my workstation and serialization to file works fine on both the bean itself and the whole Hashtable array as well, so I really can't see where the problem is.

Any help/clues whould be greatly appreciated,

Thanks!

JP.

[1263 byte] By [jparreguia] at [2007-10-2 15:00:12]
# 1

> It says my Bean class is not serializable, although

> it only contains primitive values.

Irrelevant. It means that the bean class doesn't implement Serializable.

> I have done some testing in standalone code on my

> workstation and serialization to file works fine on

> both the bean itself and the whole Hashtable array as

> well, so I really can't see where the problem is.

This is impossible if the bean class doesn't implement Serializable.

ejpa at 2007-7-13 13:45:38 > top of Java-index,Core,Core APIs...
# 2

Sorry for the late update, I've been very busy lately.

I didn't solve my problem but found a not so elegant solution by passing all the information as strings with comma separated values. However, I would prefer to use beans as a permanent solution if I found the way to overcome the serialization issues.

By the way, the bean class does implement serializable. I have re-written methods readObject and writeObject, but I'm still having the same problems.

jparreguia at 2007-7-13 13:45:38 > top of Java-index,Core,Core APIs...
# 3

So why do you ge this?

"error unmarshalling return; nested exception is: java.io.InvalidClassException: <qualified name of the bean class>; is not Serializable".

Curious that you are getting it unmarshalling the return instead of when marshalling it. This suggests that the copy at the server is Serializable but the copy at the client is not. Redeploy and retest.

ejpa at 2007-7-13 13:45:38 > top of Java-index,Core,Core APIs...
# 4
You are absolutely right!I wasn't considering the fact that the bean class had to be updated on both the server and the client.Problem solved, my code works fine now, thanks a lot.JP.
jparreguia at 2007-7-13 13:45:38 > top of Java-index,Core,Core APIs...