NullPointerException when creating ScriptingContainer with jruby complete 1.5.0
-------------------------------------------------------------------------------

                 Key: JRUBY-4798
                 URL: http://jira.codehaus.org/browse/JRUBY-4798
             Project: JRuby
          Issue Type: Bug
          Components: Embedding
    Affects Versions: JRuby 1.5
            Reporter: Paul Allton


Apologies in advance if this user error, I'm using embedded jruby inside an 
Intellij plugin[1]

This all worked under quite happily jruby complete 1.4.0, but I've just tried 
upgrading to 1.5.0 and now get a NullPointerException while trying to create a 
ScriptingContainer, specifically the exception is:

null
java.lang.NullPointerException
        at java.util.Properties$LineReader.readLine(Properties.java:365)
        at java.util.Properties.load(Properties.java:293)
        at 
java.util.PropertyResourceBundle.<init>(PropertyResourceBundle.java:96)
        at org.jruby.embed.util.PropertyReader.<init>(PropertyReader.java:52)
        at 
org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:206)
        at 
org.jruby.embed.ScriptingContainer.<init>(ScriptingContainer.java:174)
        at pmip.impl.JRubyInterpreter.init(JRubyInterpreter.java:44)

Note that I am able to create and use a ScriptingContainer 'normally' (i.e. 
outside of the Intellij plugin). There is some definitely some ClassLoader 
weirdness going when embedding in the context of a Intellij plugin, which I 
wouldn't pretend to understand, but I did manage to get working using a 
ClassLoader workaround[2] 

So, under jruby complete 1.4.0, the following code worked:

private void init() {
        ClassLoader oldClassLoader = 
Thread.currentThread().getContextClassLoader();
        Thread.currentThread().setContextClassLoader(null);
        ScriptingContainer container = new ScriptingContainer();
        Thread.currentThread().setContextClassLoader(oldClassLoader);
}

But 1.5.0 gives the null pointer - any ideas what might be going on?

[1] if it helps, the source for the plugin is available here: 
http://code.google.com/p/pmip/ or more specifically: 
http://code.google.com/p/pmip/source/browse/trunk/host/src/pmip/impl/JRubyInterpreter.java
[2] http://wiki.trialox.org/confluence/display/DEV/Using+JRuby+in+OSGi


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to