Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8352421

The following exception was encountered java.lang.NoClassDefFoundError

XMLWordPrintable

    • x86_64
    • linux

      A DESCRIPTION OF THE PROBLEM :
      When running a Java application, the following exception was encountered:
         java.lang.NoClassDefFoundError: Could not initialize class java.lang.invoke.MethodType
       This exception indicates that the java.lang.invoke.MethodType class failed to initialize during runtime, causing the program to fail to execute normally. This issue is reproducible in certain JDK versions but behaves normally in others, suggesting it may be related to specific JDK implementations.

      Affected Versions:
      JDK 21.0.5

      JDK 11.0.25

      JDK 17.0.13



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
       javac Test.java
      java Test

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Stack Overflow Error: null
      ACTUAL -
      Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class java.lang.invoke.MethodType
          at java.base/java.lang.invoke.MethodHandleNatives.findMethodHandleType(MethodHandleNatives.java:411)
          at Test.simulateForkRaceCondition(Test.java:14)
          at B176.simulateForkRaceCondition(B176.java:12)
          at Test.simulateForkRaceCondition(Test.java:12)
          at Test.simulateForkRaceCondition(Test.java:12)
          at Test.simulateForkRaceCondition(Test.java:12)
          at Test.simulateForkRaceCondition(Test.java:12)
          at Test.simulateForkRaceCondition(Test.java:12)

      ---------- BEGIN SOURCE ----------
      import java.util.Stack;

      public class Test {
          public static void main(String[] args) {
              simulateForkRaceCondition();
          }

          public static void simulateForkRaceCondition() {
              try {
                  simulateForkRaceCondition();
              } catch (StackOverflowError e) {
                  System.err.println("Stack Overflow Error: " + e.getMessage());
              }
          }
      }
      ---------- END SOURCE ----------

            coleenp Coleen Phillimore
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: