 |
Forums |
Admin Discussion Forums: help Start New Thread
| Message: 96683 |
 |
BY: Vito Botta (vitobotta) DATE: 2011-06-26 08:57 SUBJECT: Loading JRuby compiled class in Ruby 1.8.7/1. Hi all
We have a Rails 3 app that for a number of reasons must be hosted locally by our clients. This application has been free for a while during beta/testing etc, but now we are going to start charging clients to keep using the software and get updates.
So we are already switching to JRuby so that code will be compiled, and our clients - once upgraded to the new version - will be able to get updates and support but won't have any more the source code available, and will have compiled code instead for a minimum of protection.
So I have a licensing client component ready to be integrated into this app, and this licensing client connects to our central dashboard to send usage data we'll then use to calculate charges.
This is all fine with the app running under JRuby, but the problem we currently have is that migration will be gradual and will take some time before all our clients have the new version of the software protected (kind of), so in the meantime I need to make the licensing client work also when the main Rails app in still running under MRI/REE (1.8.7).
At the same time, the licensing client must still run in a compiled form just to prevent clients from (easily) being able to see how the licensing client collects and sends usage data, etc.
So I was looking for ways to load JRuby-compiled code (the licensing client) within a Rails app running under MRI, and I found Rjb.
Great, it looks it can do exactly what I am looking for!
However, I have a problem using it; when I try any of the examples I found, e.g.:
>> require "rjb"
=> true
>> puts Rjb::import('java.util.UUID').randomUUID().toString()
ca92bcb9-2b41-4358-a456-1347bb83f0f8
all works fine, but how do I load my licensing client's jar (created with Rawr)? If I load this jar by itself with
java -jar LicensingClient.jar
it works well, but I don't know how to load this with Rjb. I know I can use
Rjb::load "/location/of/LicensingClient.jar"
but then? I tried with
Rjb::import("Licensing.Client")
but I get "NoClassDefFoundError" (in the original Ruby code, Client is a class within the Licensing module).
Any idea?
Thanks!
| |
Thread View
Post a followup to this message
|
 |