Hi,
I’m getting a “Could not open any of [xml2, xslt, exslt] (LoadError)”
error when trying to run a simple Ruby program taken from the
EXAMPLES.rdoc file of the Mechanize gem.
The error is in this line of the Nokogiri module of libxml.rb: ffi_lib
‘xml2’, ‘xslt’, ‘exslt’
Not sure if there are missing gems, and if so, what to install. Any
ideas how to fix this?
Thanks very much.
Gary M.
Program – main.rb:
require ‘rubygems’
require ‘mechanize’
a = WWW::Mechanize.new { |agent|
agent.user_agent_alias = ‘Mac Safari’
}
a.get(‘http://google.com/’) do |page|
search_result = page.form_with(:name => ‘f’) do |search|
search.q = ‘Hello world’
end.submit
search_result.links.each do |link|
puts link.text
end
end
Resources I’m using:
Editor: Netbeans IDE 6.7.1
Gems installed (among others): mechanize-0.9.3, nokogiri-1.3.3-java
Operating System: Windows Vista Home Premium, Service Pack 1, 64-Bit
Error message stack:
JRuby limited openssl loaded. gem install jruby-openssl for full
support.
http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
C:/Program Files (x86)/NetBeans
6.7.1/ruby2/jruby-1.2.0/lib/ruby/1.8/ffi/library.rb:18:in ffi_lib': Could not open any of [xml2, xslt, exslt] (LoadError) from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri/ffi/libxml.rb:5 from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri/ffi/libxml.rb:31:in
require’
from C:/Program Files (x86)/NetBeans
6.7.1/ruby2/jruby-1.2.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri.rb:10 from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/nokogiri-1.3.3-java/lib/nokogiri.rb:31:in
require’
from C:/Program Files (x86)/NetBeans
6.7.1/ruby2/jruby-1.2.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/mechanize-0.9.3/lib/www/mechanize.rb:9 from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/mechanize-0.9.3/lib/www/mechanize.rb:31:in
require’
from C:/Program Files (x86)/NetBeans
6.7.1/ruby2/jruby-1.2.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/mechanize-0.9.3/lib/mechanize.rb:7 from C:/Program Files (x86)/NetBeans 6.7.1/ruby2/jruby-1.2.0/lib/ruby/gems/1.8/gems/mechanize-0.9.3/lib/mechanize.rb:36:in
require’
from C:/Program Files (x86)/NetBeans
6.7.1/ruby2/jruby-1.2.0/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require’
from
C:\Users\Gary\Documents\NetBeansProjects\HTMLTextReplacement\lib\main.rb:5