ok, i want to be able to send some data from my rails app to a CRM. The
library that defines the API for talking to the CRM is written in java.
I got JRuby working, which is pretty cool, but to my understanding i
would have to convert my ruby on rails app to a jruby on rails app
which, as far as i’ve understood, is different deal altogether and
would be set up more like a java server that fakes itself into thinking
its ruby on rails… i don’t want to complicate things any more than i
have to, but i really don’t want to write everything in Java just
because i’ll be making a few calls to the crm.
Enter YARB (yet another ruby bridge), this seems a lot less heavy and i
was gonna drop JRuby for this because it seemed like it ‘just works
TM’… problem: i can’t get it to recognize any of the functions in my
crm.jar !! i’ve tried putting it just about everywhere, but the java
core lib area itself (and i don’t want to do that). Admittedly i’m not
a java guru, but know the ropes sort of…
thanks in advance… if you have any experience with bridging these
languages let me know! this is the main focus of my work efforts right
now.
stuart
its me again… well i finally got yarb to recognize the libraries in my
crm.jar. the problem was simply a bad install of jdk.
the problem now…
one of the classes in the crm jar uses java.lang.reflect which is a
class for getting more info about java classes. anyways it crashes hard
with something like this:
java.lang.reflect.InvocationTargetException
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
JavaBridge::JException at
jbridge.ObjectManager.getInstanceId(ObjectManager.java:206)
: at jbridge.ObjectManager.createObject(ObjectManager.java:102)
java.lang.NoClassDefFoundError
org/mozilla/javascript/Scriptable
java.lang.NoClassDefFoundError: org/mozilla/javascript/Scriptable
at
com.liberated.server.ServerMaster.(ServerMaster.java:34)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown
Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at jbridge.ObjectManager.getInstanceId(ObjectManager.java:206)
at jbridge.ObjectManager.createObject(ObjectManager.java:102)
at jbridge.BridgeServer.jnew(BridgeServer.java:28)
at
jbridge.comm.binstream.BStream_JBServer$3.send(BStream_JBServer.java:148)
at
jbridge.comm.binstream.MessageServer$MethodInvocation.run(MessageServer.java:456)
at
jbridge.InvocationPool$Worker.workloop(InvocationPool.java:97)
at
jbridge.InvocationPool$Worker.access$000(InvocationPool.java:55)
at jbridge.InvocationPool$1.run(InvocationPool.java:62)
at java.lang.Thread.run(Unknown Source)
at jbridge.BridgeServer.jnew(BridgeServer.java:28)
at
jbridge.comm.binstream.BStream_JBServer$3.send(BStream_JBServer.java:148)
from /usr/lib/ruby/site_ruby/1.8/yajb/bstream.rb:655:in value' from /usr/lib/ruby/site_ruby/1.8/yajb/bstream.rb:810:in
send_message’
from /usr/lib/ruby/site_ruby/1.8/yajb/bstream.rb:1048:in
send_message' from /usr/lib/ruby/site_ruby/1.8/yajb/comm_bstream.rb:59:in
send_message_to_java’
from /usr/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:506:in
__send_message_to_java' from /usr/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:776:in
initialize’
from /usr/lib/ruby/site_ruby/1.8/yajb/jbridge.rb:552:in `jnew’
from (irb):20
from :0 at
jbridge.comm.binstream.MessageServer$MethodInvocation.run(MessageServer.java:456)
irb(main):021:0> at
jbridge.InvocationPool$Worker.workloop(InvocationPool.java:97)
at
jbridge.InvocationPool$Worker.access$000(InvocationPool.java:55)
at jbridge.InvocationPool$1.run(InvocationPool.java:62)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NoClassDefFoundError:
org/mozilla/javascript/Scriptable
at
com.liberated.server.ServerMaster.(ServerMaster.java:34)
… 13 more
i guess that reflect library is probably freaking out because its not
looking at a real Java class? anybody know a way around this?