« Return to Thread: Serializing Ruby objects from Java

Re: Serializing Ruby objects from Java

by Charles Oliver Nutter-4 :: Rate this Message:

Reply to Author | View in Thread

On Sat, Jun 13, 2009 at 2:35 AM, Peter Voss<info@...> wrote:
> Hi,
>
> I am wondering how I can serialize a class written in Ruby from Java.
>
> The Java codebase that I am working on expects some classes to be
> serializable to be able to execute the custom operations that they provide
> on other JVMs. I wanted to provide a Ruby integration that allows to
> implement some of those classes in Ruby.
...
> I can't write this object to an ObjectOutputStream. If I do this, I get this
> Exception:
> Exception in thread "main" java.io.NotSerializableException:
> org.jruby.RubyClass$VariableAccessor

At the moment, this is not possible. Because every Ruby object needs
to have a reference to an org.jruby.Ruby instance, which does not have
a "global" or "static" instance, there's no way to serialize Ruby
objects with normal Java serialization. It's one of the gaps we're
hoping to fill this summer. Your best option for now would probably be
to write a Java data-carrying object and serialize that.

- Charlie

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Serializing Ruby objects from Java