Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoClassDefFoundError from time to time. #3508

Closed
slackfan opened this issue Dec 1, 2015 · 1 comment
Closed

NoClassDefFoundError from time to time. #3508

slackfan opened this issue Dec 1, 2015 · 1 comment

Comments

@slackfan
Copy link

slackfan commented Dec 1, 2015

Hi,

I have an application which - since some weeks (it became obvious after some weeks of JRuby 9k usage) and only from time to time (aka not easy reproducible) - is raising an java.lang.NoClassDefFoundError exception such as the following.

The class loading code did not change since a long time and the error happens not always.

The application itself is a combination of some rake tasks which may invoke Java code.

The odd situation is that the classes which cause the NoClassDefFoundError are never called directly by the JRuby code but indirectly through Java code which is called by JRuby. It's also not nessecarily the same missing class. It may also be a completely different jar where the missing class comes from. The jar loading code is

      $CLASSPATH << directory
      classLoader = JRuby.runtime.jruby_class_loader
      Dir.glob('%s/*.jar' % [directory]).each do |jar|
        @@semaphore.synchronize do
          # The well known require or CLASSPATH statements cause issues on
          # Windows in case the loaded and executed java code itself tries to
          # load jar files.
          #
          # Due to this we use
          # http://calavera.github.io/2011/02/09/jruby-class-loader-by-example.html
          classLoader.add_url(Java::JavaIo::File.new(jar).to_url)
        end
      end

I am seeking for guidenance what to look for. What has changed here, may it be related to the threading rake performs or are there changes with the JRuby class loader since 1.7? I definitely can confirm that the jar files are loaded at least once.

The used JRuby version is 9.0.1.0 and 9.0.4.0. The JVM is Oracle Java 1.8.0u60 using Windows 2008 R2 Server or Windows 2012 Server.

S:/Tools/jruby-9.0.4.0/lib/ruby/stdlib/rake/task.rb:185: warning: singleton on non-persistent Java type Java::JavaLang::NoClassDefFoundError (http://wiki.jruby.org/Persistence)

Unhandled Java exception: java.lang.NoClassDefFoundError: com/bananarama/api/configuration/ParameterDataset
java.lang.NoClassDefFoundError: com/bananarama/api/configuration/ParameterDataset
               defineClass1 at java/lang/ClassLoader.java:-2
                defineClass at java/lang/ClassLoader.java:760
                defineClass at java/security/SecureClassLoader.java:142
                defineClass at java/net/URLClassLoader.java:467
                 access$100 at java/net/URLClassLoader.java:73
                        run at java/net/URLClassLoader.java:368
                        run at java/net/URLClassLoader.java:362
               doPrivileged at java/security/AccessController.java:-2
                  findClass at java/net/URLClassLoader.java:361
                  loadClass at java/lang/ClassLoader.java:424
                  loadClass at java/lang/ClassLoader.java:357
        getDeclaredMethods0 at java/lang/Class.java:-2
  privateGetDeclaredMethods at java/lang/Class.java:2701
         getDeclaredMethods at java/lang/Class.java:1975
                 getMethods at org/jruby/javasupport/binding/Initializer.java:427
          setupClassMethods at org/jruby/javasupport/binding/ClassInitializer.java:123
                 initialize at org/jruby/javasupport/binding/ClassInitializer.java:38
            setupProxyClass at org/jruby/javasupport/binding/Initializer.java:80
           createProxyClass at org/jruby/javasupport/Java.java:560
         generateClassProxy at org/jruby/javasupport/Java.java:517
   createProxyClassForClass at org/jruby/javasupport/Java.java:473
               computeValue at org/jruby/javasupport/JavaSupportImpl.java:124
               computeValue at org/jruby/javasupport/JavaSupportImpl.java:116
                        get at org/jruby/util/collections/MapBasedClassValue.java:25
     getProxyClassFromCache at org/jruby/javasupport/JavaSupportImpl.java:190
              getProxyClass at org/jruby/javasupport/Java.java:442
              getProxyClass at org/jruby/javasupport/Java.java:436
            get_proxy_class at org/jruby/javasupport/Java.java:428
            get_proxy_class at org/jruby/javasupport/JavaUtilities.java:34
               cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:313
                       call at org/jruby/runtime/callsite/CachingCallSite.java:163
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:290
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:83
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:197
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:183
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
                    finvoke at org/jruby/RubyClass.java:756
                     invoke at org/jruby/runtime/Helpers.java:401
                 callMethod at org/jruby/RubyBasicObject.java:376
                  interpret at org/jruby/ir/instructions/ConstMissingInstr.java:67
             processOtherOp at org/jruby/ir/interpreter/StartupInterpreterEngine.java:191
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:115
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:77
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:162
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:148
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:189
               cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:293
                       call at org/jruby/runtime/callsite/CachingCallSite.java:131
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:306
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:77
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:162
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:148
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:189
               cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:293
                       call at org/jruby/runtime/callsite/CachingCallSite.java:131
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:306
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:77
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:162
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:148
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:189
               cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:293
                       call at org/jruby/runtime/callsite/CachingCallSite.java:131
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:306
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:122
            commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:136
                       call at org/jruby/runtime/IRBlockBody.java:59
                       call at org/jruby/runtime/Block.java:106
                       call at org/jruby/RubyProc.java:334
                     call19 at org/jruby/RubyProc.java:318
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:201
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
                       call at org/jruby/runtime/callsite/CachingCallSite.java:161
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:290
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:122
            commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:136
                    doYield at org/jruby/runtime/IRBlockBody.java:152
                      yield at org/jruby/runtime/BlockBody.java:78
                      yield at org/jruby/runtime/Block.java:147
                       each at org/jruby/RubyArray.java:1560
                       call at org/jruby/internal/runtime/methods/JavaMethod.java:494
                  callBlock at org/jruby/runtime/callsite/CachingCallSite.java:77
                       call at org/jruby/runtime/callsite/CachingCallSite.java:83
                  interpret at org/jruby/ir/instructions/CallBase.java:419
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:322
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:83
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:197
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:183
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
                       call at org/jruby/runtime/callsite/CachingCallSite.java:161
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:290
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:122
            commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:136
              yieldSpecific at org/jruby/runtime/IRBlockBody.java:67
              yieldSpecific at org/jruby/runtime/Block.java:116
              yieldSpecific at org/jruby/ir/runtime/IRRuntimeHelpers.java:457
            mon_synchronize at S:/GAIA/CORE/jruby-9.0.4.0/lib/ruby/stdlib/monitor.rb:211
                       call at org/jruby/internal/runtime/methods/CompiledIRMethod.java:101
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:111
                       call at org/jruby/internal/runtime/methods/AliasMethod.java:101
                  callBlock at org/jruby/runtime/callsite/CachingCallSite.java:77
                       call at org/jruby/runtime/callsite/CachingCallSite.java:83
                  interpret at org/jruby/ir/instructions/CallBase.java:419
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:322
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:127
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:113
                  callBlock at org/jruby/runtime/callsite/CachingCallSite.java:77
                       call at org/jruby/runtime/callsite/CachingCallSite.java:83
                  interpret at org/jruby/ir/instructions/CallBase.java:419
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:322
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:77
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:162
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:148
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:189
               cacheAndCall at org/jruby/runtime/callsite/CachingCallSite.java:293
                       call at org/jruby/runtime/callsite/CachingCallSite.java:131
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:306
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:122
            commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:136
                       call at org/jruby/runtime/IRBlockBody.java:59
                       call at org/jruby/runtime/Block.java:106
                       call at org/jruby/RubyProc.java:334
                     call19 at org/jruby/RubyProc.java:318
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:201
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
                       call at org/jruby/runtime/callsite/CachingCallSite.java:161
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:290
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:122
            commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:136
                    doYield at org/jruby/runtime/IRBlockBody.java:152
                      yield at org/jruby/runtime/BlockBody.java:78
                      yield at org/jruby/runtime/Block.java:147
                       each at org/jruby/RubyArray.java:1560
                       call at org/jruby/internal/runtime/methods/JavaMethod.java:494
                  callBlock at org/jruby/runtime/callsite/CachingCallSite.java:77
                       call at org/jruby/runtime/callsite/CachingCallSite.java:83
                  interpret at org/jruby/ir/instructions/CallBase.java:419
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:322
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
                  interpret at org/jruby/ir/interpreter/InterpreterEngine.java:83
           INTERPRET_METHOD at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:197
                       call at org/jruby/internal/runtime/methods/MixedModeIRMethod.java:183
                       call at org/jruby/internal/runtime/methods/DynamicMethod.java:197
                       call at org/jruby/runtime/callsite/CachingCallSite.java:161
                processCall at org/jruby/ir/interpreter/InterpreterEngine.java:290
                  interpret at org/jruby/ir/interpreter/StartupInterpreterEngine.java:77
            INTERPRET_BLOCK at org/jruby/ir/interpreter/Interpreter.java:122
            commonYieldPath at org/jruby/runtime/MixedModeIRBlockBody.java:136
              yieldSpecific at org/jruby/runtime/IRBlockBody.java:67
              yieldSpecific at org/jruby/runtime/Block.java:116
              yieldSpecific at org/jruby/ir/runtime/IRRuntimeHelpers.java:457
            mon_synchronize at S:/Tools/jruby-9.0.4.0/lib/ruby/stdlib/monitor.rb:211
@headius
Copy link
Member

headius commented Sep 18, 2019

This is several years old and I suspect it was an environment issue or something we or the JDK have fixed. If you can still reproduce this on a recent JDK 8+ and JRuby 9.2+, please open as a new issue.

@headius headius closed this as completed Sep 18, 2019
@headius headius added this to the Invalid or Duplicate milestone Sep 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants