On Tue, Mar 19, 2013 at 5:48 PM, Mike Davidson <mike.david...@raritan.com>wrote:

> When using THREADSAFE Gem path looks like:
>
> ["/opt/application/lib/configuration/org.eclipse.osgi/bundles/3/1/.cp/META-INF/jruby.home/lib/ruby/gems/shared",
> "/.gem/jruby/1.9"]
>
> When using CONCURRENT Gem path looks like:
>
> ["classpath:/META-INF/jruby.home/lib/ruby/gems/shared", "/.gem/jruby/1.9"]
>
> Has anyone come across a similar issue?
>

Delayed response, but I poked at this a bit this morning, and am unable to
replicate your Gem path issue.  For the sake of completeness, I'm running
this on Equinox (from Eclipse Juno), using jruby-complete-1.7.3.jar (p2
packaged at http://ajuckel.github.com/jruby.p2/), with the following code:

Service bundle:
    public ScriptingContainer createRuby(String engineName, Class<?> clazz)
{
        return new OSGiScriptingContainer(
            FrameworkUtil.getBundle(RubyRuntimeService.class),
LocalContextScope.CONCURRENT,
            LocalVariableBehavior.PERSISTENT);
    }

In my Equinox application:
    @Override
    public Object start(IApplicationContext context) throws Exception {
        BundleContext bc =
FrameworkUtil.getBundle(JRubySampleApplication.class).getBundleContext();
        tracker = new ServiceTracker<IRubyRuntimeService,
IRubyRuntimeService>(bc, IRubyRuntimeService.class, null);
        tracker.open();
        IRubyRuntimeService service = tracker.waitForService(1000);
        if (null == service) {
            System.err.println("Couldn't find runtime service");
            return Integer.valueOf(100);
        }

        ScriptingContainer container = service.createRuby("sample",
this.getClass());
        Object obj = container.runScriptlet("require 'rubygems';
Gem.path()");
        System.out.println("Ruby result: " + obj);
        return Integer.valueOf(0);
    }

And I get result:
Ruby result: ["/Users/awj/src/jruby/
rcp.jruby.ws/.metadata/.plugins/org.eclipse.pde.core/Ruby Sample
App/org.eclipse.osgi/bundles/117/1/.cp/META-INF/jruby.home/lib/ruby/gems/shared",
"/Users/awj/.gem/jruby/1.9"]

Have I done anything different from you?  What OSGi framework are you
using?  Is there a particular bundled gem that you're unable to load?

Reply via email to