Hi,
On 14.06.2009, at 20:46, Charles Oliver Nutter wrote:
> 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.
Ok, great. Is there an issue that I could track or even make
contributions to?
Regarding the data-carrying object: How would I then transfer the
actual ruby code and create a new instance? I am new to JRuby and more
a Java programmer. In the Java world I have to have the class file of
the object that I want to deserialize on the class path. But the Ruby
object is defined in a script that might contain class definitions
plus some business logic. Something like:
1000.times do |x|
puts x
end
class SomeClass
....
end
To create a new instance of SomeClass (as part of the deserialization)
I can't simply eval the full Ruby script to create a new instance of
SomeClass. Any ideas on how to achieve that?
Thanks for your help,
--Peter
> - Charlie
>
> ---------------------------------------------------------------------
> To unsubscribe from this list, please visit:
>
>
http://xircles.codehaus.org/manage_email>
>
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email