org.jruby.rack.RackInitializationException: IO error -- hpricot_scan

Hi all,

I am trying to use Hpricot with a JRuby application, that is being
deployed
to JBoss. Here are the relevant version numbers:

JBoss 5.1.0.GA http://5.1.0.ga/
JRuby 1.5.0
JDK 1.5.0_22

The application works correctly when I run it in Webrick (on Jruby),
but,
when I package the app into a WAR file using warbler, and deploy it to
Jboss, I keep getting this exception in the stack trace (more below):

org.jruby.rack.RackInitializationException: IO error – hpricot_scan
from /home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:inhttp://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
require' from /home/jboss/ jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:20<http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:20> from /home/jboss/ jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:31:in<http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:31:in> require’
from /home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inhttp://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /home/jboss/ jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:9<http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:9> from /home/jboss/ jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:31:in<http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:31:in> require’
from /home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:inhttp://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from /home/jboss/ jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub.rb:2<http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub.rb:2> ... 7 levels... from /home/jboss/ jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22:in<http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22:in> instance_eval’
from /home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22:inhttp://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22:in
`initialize’
from :3

    at

org.jruby.rack.DefaultRackApplicationFactory$4.init(DefaultRackApplicationFactory.java:154)
at
org.jruby.rack.PoolingRackApplicationFactory$1.run(PoolingRackApplicationFactory.java:159)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.jruby.exceptions.RaiseException
at (unknown).initialize(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:20http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:20
)
at (unknown).(unknown)(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:31http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot-0.8.4-java/lib/hpricot.rb:31
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:9http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:9
)
at (unknown).(unknown)(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:31http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub/hpricot_scrub.rb:31
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub.rb:2http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub.rb:2
)
at (unknown).(unknown)(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub.rb:36http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/gems/gems/hpricot_scrub-0.3.10/lib/hpricot_scrub.rb:36
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-complete-1.1.6.jar/META-INF/jruby.home/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36
)
at Kernel.require(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/config/environment.rb:50http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/config/environment.rb:50
)
at (unknown).(unknown)(/home/jboss/
jboss-5.1.0.GA/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/config/environment.rb:29http://jboss-5.1.0.ga/server/default/tmp/5j3k6m19-2s6imm-gsaeemus-1-gsaefc4s-20/REEport.war/WEB-INF/config/environment.rb:29
)
at Kernel.load(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/jruby/rack/rails.rb:29http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/jruby/rack/rails.rb:29
)
at JRuby::Rack::RailsServletHelper.load_environment(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/jruby/rack/rails.rb:152http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/jruby/rack/rails.rb:152
)
at #Class:01x110a6bf3.new(:3)
at (unknown).(unknown)(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22
)
at Kernel.instance_eval(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22
)
at Kernel.instance_eval(/home/jboss/
jboss-5.1.0.GA/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22http://jboss-5.1.0.ga/server/default/deploy/REEport.war/WEB-INF/lib/jruby-rack-0.9.3.jar/rack/builder.rb:22
)
at Rack::Builder.initialize(:3)
at (unknown).(unknown)(:1)

I have tried packaging the hpricot-scan.jar and fast_xs.jar into the WAR
file, I have also copied them into $JRUBY_HOME/lib and
$JBOSS_HOME/default/server/lib but that has not helped. It seems like
it
can’t read/find the jar file, but I’m not sure what else to try.

Any help would be greatly appreciated!
Thanks
Venka

You mention using JRuby 1.5.0 but in your stack it’s using
jruby-complete-1.1.6.jar. Shouldn’t that be jruby-complete-1.5.0.jar?

Can you try using a more recent version of JRuby-Rack? The latest is
1.0.10. It should print more helpful diagnostic information on the
console when this error happens. I’d also second Ben’s suggestion to
make sure you’re using a more recent JRuby version.

/Nick

On Wed, Sep 7, 2011 at 10:28 AM, Venka A.

Upgrading to the jruby-complete1.5.0.jar resolved the issue.

Thanks!