Serializing beanshell Objects

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Serializing beanshell Objects

Christian Zumbiehl
Hi,
I have a problem serializing classes declared in a bean shell script.

I create an instance of  simple Serializable class in a .bsh , and pass it to a (pure) Java class in order to be serialized and stored in a DB.

I have noticed under debugger, the object I get in my class contains a reference to XThis in addition to the attributes of the class.
This is a problem as it's too large to fit in my DB , and I don't want it there.

I have tried the prune() which does nothing to my surprise , I have investigated a solution using reflection API, but it gets too hard.

Anybody else has experienced this or has an idea how to get rid of XThis before serialization ?

cheers
christian

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users
Reply | Threaded
Open this post in threaded view
|

Re: Serializing beanshell Objects

Stewart Cambridge
Try overriding the readObject and writeObject methods to change the
default serialization behavior, as explained in this article.
http://java.sun.com/developer/technicalArticles/ALT/serialization/

On 09/08/07, Christian Zumbiehl <[hidden email]> wrote:

> Hi,
> I have a problem serializing classes declared in a bean shell script.
>
> I create an instance of  simple Serializable class in a .bsh , and pass it to a (pure) Java class in order to be serialized and stored in a DB.
>
> I have noticed under debugger, the object I get in my class contains a reference to XThis in addition to the attributes of the class.
> This is a problem as it's too large to fit in my DB , and I don't want it there.
>
> I have tried the prune() which does nothing to my surprise , I have investigated a solution using reflection API, but it gets too hard.
>
> Anybody else has experienced this or has an idea how to get rid of XThis before serialization ?
>
> cheers
> christian
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems?  Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >>  http://get.splunk.com/
> _______________________________________________
> Beanshell-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/beanshell-users
>

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
Beanshell-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/beanshell-users