Bugs item #10998, was opened at 2007-05-21 20:39
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=10998&group_id=2014
Category: rails-integration
Group: None
Status: Open
Resolution: None
Priority: 3
Submitted By: Ashish Sahni (whacko)
Assigned to: Robert Egglestone (tantalon)
Summary: add WEB-INF/lib to jruby-runtime loadpath
Initial Comment:
For 'require xyz.jar' to work from a ruby script,
the directory containing xyz.jar needs to be added
to the runtime's load path.
Typically for a webapp the jars would reside in WEB-INF/lib
and therefore adding WEB-INF/lib would make sense.
The code changes would look something like
// RailsContextListener.java
railsFactory.addToLoadPath(getPath("/WEB-INF/lib"))
// RailsFactory.java
List lps = new ArrayList();
public void addToLoadPath(String s) { lps.add(s); }
// in makeObject
loadPaths.addAll(lps);
----------------------------------------------------------------------
>Comment By: Ashish Sahni (whacko)
Date: 2007-05-21 21:35
Message:
That makes sense since loading in JRuby uses the java class/classloader
getResource* API for loading scripts,
but for some reason (class/resource loading mystery)
I get the following error without explicitly adding WEB-INF/lib to the load path
{noformat}
MissingSourceFile in SayController#hello
no such file to load -- mylookup
RAILS_ROOT: <mydir>bs/config/..
Application Trace | Framework Trace | Full Trace
bs/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
bs/loader/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`require'
<mydir>bs/WEB-INF/gems/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:494:in
`require'
#{RAILS_ROOT}/app/controllers/say_controller.rb:7:in `new_constants_in'
<mydir>bs/WEB-INF/gems/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:495:in
`require'
#{RAILS_ROOT}/app/controllers/say_controller.rb:7:in `hello'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in
`send'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/base.rb:1095:in
`perform_action'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/filters.rb:631:in
`call_filter'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/filters.rb:619:in
`perform_action_with_filters'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:65:in
`perform_action_with_benchmark'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
`measure'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/benchmarking.rb:66:in
`perform_action_with_benchmark'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/rescue.rb:83:in
`perform_action_with_rescue'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/base.rb:431:in
`send'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/base.rb:431:in
`process'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/filters.rb:624:in
`process_with_filters'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/session_management.rb:114:in
`process_with_session_management_support'
<mydir>bs/WEB-INF/gems/gems/actionpack-1.13.3/lib/action_controller/base.rb:330:in
`process'
:0
{noformat}
----------------------------------------------------------------------
Comment By: Robert Egglestone (tantalon)
Date: 2007-05-21 21:21
Message:
The jars are automatically added to the classpath, and the classpath is on the
loadpath.
----------------------------------------------------------------------
You can respond by visiting:
http://rubyforge.org/tracker/?func=detail&atid=7857&aid=10998&group_id=2014
_______________________________________________
Jruby-extras-devel mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/jruby-extras-devel