There are some good resources out there on how Tomcat’s classloading
works. The official ones are on the tomcat site, for example:
http://tomcat.apache.org/tomcat-6.0-doc/class-loader-howto.html
http://tomcat.apache.org/tomcat-5.5-doc/class-loader-howto.html
See also: Java Classloader - Wikipedia
I think the classloaders for Tomcat, etc. usually load jars in the order
that they were returned from java.io.File.list() and this order is not
guaranteed, so basically, as much as possible you especially want to try
to avoid situations where there are two versions of the same jar loaded
by the same classloader (in this case, the same classloader was loading
from jars in the webapp’s WEB-INF/lib I assume).
So, enough of all of that since you just want to know how to fix?
As Nick described in the example config for jruby-rack jar, you can
configure Warbler to include specific versions of jruby and jruby-rack
jars by doing this in warble.rb:
Additional Java .jar files to include. Note that if .jar files are
placed
in lib (and not otherwise excluded) then they need not be mentioned
here.
JRuby and JRuby-Rack are pre-loaded in this list. Be sure to include
your
own versions if you directly set the value
config.java_libs += FileList[“lib/java/*.jar”]
config.java_libs.delete_if {|f| f =~ /jruby-rack/ || f =~
/jruby-complete/ }
config.java_libs += FileList[“lib/jruby-complete*.jar”]
config.java_libs += FileList[“lib/jruby-rack*.jar”]
This example removes any jars containing jruby-rack and jruby-complete
in the filenames, and then adds only the ones you put into your lib
directory. You could change that to whatever best fits.
I think Nick said that he is going to probably remove those from being
packaged by warbler in a future release.
Be sure that if you do this that you are using the same version of JRuby
(and jruby-rack) in your lib (which will be packaged in the war) as the
one for your tests!
Gary
P.S.- another example here if you’re interested in using the latest
jruby trunk:
http://stufftohelpyouout.blogspot.com/2009/06/how-to-get-warbler-to-include-custom.html
F2Andy wrote:
2009/6/23 F2Andy [email protected]:
Cheers,
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email