I am trying to deploy a simple rails app on glassfish v3 using jdk6 u18,
jruby 1.4.0 and it gives
require_frameworks': librarysocket’ could not be loaded:
java.lang.LinkageError: loader (instance of java/net/URLClassLoader):
attempted duplicate class definition for name:
process' from /tools/jruby-1.4.0/lib/ruby/gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:inrun’
from /myhome/vivekmz/dev/depot/config/environment.rb:31:in `require’
My understanding of “LinkageError:attempted duplicate class definition
name:” tells that it might be the race condition in URLClassLoader that
might be causing this. For example, multiple threads are asking a
ClassLoader.findClass() to load a class and if findClass() is not
synchronized there is chance that one thread is already loaded the class
second thread’s call to ClassLoader.findClass() load the same class
resulting in to this error. I am not sure what fixes went in to jdk6 u18
thats causing it.
Another detail is that glassfish gem or webrick works just fine with it.
only in the glassfish v3 server environment which has osgi runtime this
error happens. On glassfish side we will continue to investigate. Can
experts shed some light on this kind of error and how JRuby loads rails?
Here is the reference to the discussion on glassfish forum: