java.lang.LinkageError help me!

Hi all,

I use NetBean 6.9.1 to run Depot Application demo but it does not run.

Here is the error message
SEVERE: library socket' could not be loaded: java.lang.LinkageError: loader (instance of java/net/URLClassLoader): attempted duplicate class definition for name: "org/jruby/ext/socket/RubySocket" from C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:134:inprocess’
from C:/Program Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in
run' from C:/Users/haianh/Documents/NetBeansProjects/Depot/config/environment.rb:37 from C:/Users/haianh/Documents/NetBeansProjects/Depot/config/environment.rb:31:inrequire’
from C:/Program Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from file:/C:/Program Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:98:inload_application’
from file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:75:in
initialize' from file:/C:/Program Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25:innew’
from file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25:in
new' from <script>:1 C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:271:inrequire_frameworks’: library socket' could not be loaded: java.lang.LinkageError: loader (instance of java/net/URLClassLoader): attempted duplicate class definition for name: "org/jruby/ext/socket/RubySocket" (RuntimeError) from C:/Program Files/NetBeans 6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:134:inprocess’
from C:/Program Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113:in
run' from C:/Users/haianh/Documents/NetBeansProjects/Depot/config/environment.rb:37 from C:/Users/haianh/Documents/NetBeansProjects/Depot/config/environment.rb:31:inrequire’
from C:/Program Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
require' from file:/C:/Program Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:98:inload_application’
from file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:75:in
initialize' from file:/C:/Program Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25:innew’
from file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25:in
`new’
from :1
…internal jruby stack elided…
from Rails::Initializer.require_frameworks(C:/Program
Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:134)
from Rails::Initializer.process(C:/Program Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/gems/1.8/gems/rails-2.3.8/lib/initializer.rb:113)
from
#Class:01x79318309.run(C:/Users/haianh/Documents/NetBeansProjects/Depot/config/environment.rb:37)
from
(unknown).(unknown)(C:/Users/haianh/Documents/NetBeansProjects/Depot/config/environment.rb:31)
from Kernel.require(C:/Program Files/NetBeans
6.9.1/ruby/jruby-1.5.1/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31)
from Kernel.require(file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:98)
from Rack::Adapter::Rails.load_application(file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/rack/adapter/rails.rb:75)
from Rack::Adapter::Rails.initialize(file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25)
from (unknown).new(file:/C:/Program
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25)
from #Class:01x2748ea70.new(:1)
from (unknown).(unknown)(:1)

My enviroment include Win7 64bit, JDK 6u21, mysql 5.1.49, jruby-1.5.1,
rails-2.3.8

Can anyone guides me to fix the error? Thank in advance :slight_smile:

The error is unsolved. It is the compatible issue between jdk and others
component(may be jruby). Only way to pass this error is downgrade jdk
version. Only jdk6u17 doesn’t cause error, newer version from jdku18
will cause error.

By downgrade jdk, now i fix the error.

The problem here is that Java 6 higher than u17 seems to have problems
reflectively loading inner classes before their containing class has
been loaded. This worked fine in prior versions, but now we must load
the containing class first.

We have fixed all instances of this pattern in JRuby and in libraries
we control, but I’m convinced it’s a JDK/JVM issue. We’ve never had
this problem anywhere but on Hotspot (Sun/OpenJDK), and there’s
nothing in any of the library or language specs I’ve found that
indicate we’re doing something wrong.

So it’s fixed for 1.6. As a workaround, you can add this code before
you require ‘socket’:

require ‘java’
org.jruby.ext.socket.RubySocket
require ‘socket’

This will force RubySocket to load earlier than the inner class that
initializes the ‘socket’ library, and the error should go away.

Feel free to complain to Sun/Oracle about this particular issue :slight_smile:

  • Charlie

On Thu, Aug 5, 2010 at 11:36 PM, Hai anh Le [email protected]
wrote:

process' require’
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25:in
process' require’
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25:in
    from
Files/glassfish-3.0.1/glassfish/modules/grizzly-jruby.jar!/jruby/rack/rails.rb:25)

To unsubscribe from this list, please visit:

  http://xircles.codehaus.org/manage_email


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email