I am embedding JRuby on a JAR file and it's being used by a EAR file that I am deploying to WebSphere. When I call the class from my workspace, it works fine, however when I call it inside WebSphere, here's what I get:
[3/31/11 11:21:15:984 BRT] 00000042 SystemErr R classpath:/lib/xmlcompare.rb:4:in `require': no such file to load -- rubygems (LoadError)
from classpath:/lib/xmlcompare.rb:4
from classpath:/lib/xmlcompare.rb:1:in `require'
from <script>:1
After some research, I noticed that when I run the code in the JAR file from the command line, the loadpath looks like this:
lib
lib/gems/builder-3.0.0/lib
lib/gems/rainbow-1.1.1/lib
lib/gems/syntax-1.0.0/lib
lib/gems/xml-simple-1.0.14/lib
file:/C:/RSA/workspace/sdops-XmlCompare/pkg/XmlCompare.jar!/META-INF/jruby.home/lib/ruby/site_ruby/1.8
file:/C:/RSA/workspace/sdops-XmlCompare/pkg/XmlCompare.jar!/META-INF/jruby.home/lib/ruby/site_ruby/shared
file:/C:/RSA/workspace/sdops-XmlCompare/pkg/XmlCompare.jar!/META-INF/jruby.home/lib/ruby/1.8
.
However, after the JAR is deployed to WebSphere (bundled with an EAR), here's how the loadpath looks:
lib
lib/gems/builder-3.0.0/lib
lib/gems/rainbow-1.1.1/lib
lib/gems/syntax-1.0.0/lib
lib/gems/xml-simple-1.0.14/lib
C:/WINDOWS/TEMP//lib/ruby/site_ruby/1.8
C:/WINDOWS/TEMP//lib/ruby/site_ruby/shared
C:/WINDOWS/TEMP//lib/ruby/1.8
.
I have tried adding a few more entries to the loadpath:
Making it:
lib
lib/gems/builder-3.0.0/lib
lib/gems/rainbow-1.1.1/lib
lib/gems/syntax-1.0.0/lib
lib/gems/xml-simple-1.0.14/lib
META-INF/lib/ruby/site_ruby/1.8
META-INF/lib/ruby/site_ruby/shared
META-INF/lib/ruby/1.8
C:/WINDOWS/TEMP//lib/ruby/site_ruby/1.8
C:/WINDOWS/TEMP//lib/ruby/site_ruby/shared
C:/WINDOWS/TEMP//lib/ruby/1.8
.
But that didn't make any change.
Do you have any clue why the loadpath gets corrupted when running inside WebSphere and how to fix it?