I'm using JRuby in a Rails application, which is supported by a Java backend. One of the Java Interface functions requires a hashmap be passed from the JRuby to the Ruby code, and I'm running into an unexpected RuntimeException in this case.
end
This construction causes no errors in JRuby, and I can nicely access the map as expected.
The trouble comes when I attempt to pass this map into Java:
NativeException (java.lang.RuntimeException: org.jcodings.specific.ASCIIEncoding):
org/apache/activemq/command/ActiveMQObjectMessage.java:111:in `storeContent'
org/apache/activemq/command/ActiveMQObjectMessage.java:162:in `setObject'
org/apache/activemq/ActiveMQSession.java:380:in `createObjectMessage'
org/logicblaze/lingo/jms/marshall/DefaultMarshaller.java:60:in `createRequestMessage'
org/logicblaze/lingo/jms/JmsClientInterceptor.java:131:in `invoke'
net/zerofootprint/jms/JmsProxyFactoryBean.java:58:in `invoke'
org/springframework/aop/framework/ReflectiveMethodInvocation.java:172:in `proceed'
org/springframework/aop/framework/JdkDynamicAopProxy.java:202:in `invoke'
$Proxy15:-1:in ...(I've removed my application specific details here, as they seem unimportant)
That is the stacktrace that I get on my rails log, and in my java log I get:
java.lang.RuntimeException: org.jcodings.specific.ASCIIEncoding
... (similar trace to above)
Caused by: java.io.NotSerializableException: org.jcodings.specific.ASCIIEncoding
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1164)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1518)
at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1483)
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1400)
at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1158)
at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:330)
at java.util.HashMap.writeObject(HashMap.java:1000)
... (far too long for inclusion)
As you can see, I am using ActiveMQ as my broker, and have the java running in a Tomcat instance, while the JRuby is running inside Trinidad.
I'm not sure if the HashMap here is a red herring, but it seems that whatever I put into the hashmap causes this exception.
Finally, I tried using an empty hashmap, and that seemed to work ok.
I hope someone can lend me a bright Idea.
--
Ian Bentley