bootclasspath prevents use of embedding api from ruby
-----------------------------------------------------
Key: JRUBY-4521
URL: http://jira.codehaus.org/browse/JRUBY-4521
Project: JRuby
Issue Type: Bug
Components: Embedding
Environment: OS X, Linux
Reporter: Damian Steer
Priority: Minor
(Reported on IRC by xraid)
{code}
pl...@snowball:/tmp$ jirb
irb(main):001:0> require 'java'
=> true
irb(main):002:0> container = org.jruby.embed.ScriptingContainer.new
NativeException: java.lang.NullPointerException: null
from org/jruby/embed/ScriptingContainer.java:232:in `prepareProperties'
from org/jruby/embed/ScriptingContainer.java:209:in `<init>'
from org/jruby/embed/ScriptingContainer.java:173:in `<init>'
from sun/reflect/NativeConstructorAccessorImpl.java:-2:in `newInstance0'
from sun/reflect/NativeConstructorAccessorImpl.java:57:in `newInstance'
from sun/reflect/DelegatingConstructorAccessorImpl.java:45:in
`newInstance'
from java/lang/reflect/Constructor.java:532:in `newInstance'
from org/jruby/javasupport/JavaConstructor.java:259:in
`newInstanceDirect'
from
/home/pldms/Development/CVS-Other/jruby/lib/ruby/site_ruby/shared/builtin/javasupport/java.rb:51:in
`new'
from (irb):3
{code}
The problem is that in {{ScriptingContainer}} {{getClass().getClassLoader()}}
is null, so accessing resources causes a NPE. The reason is given here:
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#getClassLoader()
{quote}
Some implementations may use null to represent the bootstrap class loader. This
method will return null in such implementations if this class was loaded by the
bootstrap class loader.
{quote}
Moving jruby to normal classpath resolves this issue.
--
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