Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-4393

ExceptionInInitializerError due to NPE in SqlCallBinding caused by circular dependency

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.27.0
    • None

    Description

      See discussion here: https://lists.apache.org/thread.html/red0fc146f78a196af6fdaa5393b2c0906e0a49361a1734a850185777%40%3Cdev.calcite.apache.org%3E

      ExceptionInInitializerError on WebSphere 9 (on Ubuntu) when trying to start an application that uses Calcite (shaded) library. The exception message reads:

       **         error [-]: Unexpected error.
       **               ...
       **               Caused by: java.lang.BootstrapMethodError: java.lang.ExceptionInInitializerError
       **               com.onwbp.org.apache.calcite.sql.type.InferTypes.<clinit>(InferTypes.java:41)
       **               com.onwbp.org.apache.calcite.sql.fun.SqlMultisetSetOperator.<init>(SqlMultisetSetOperator.java:43)
       **               com.onwbp.org.apache.calcite.sql.fun.SqlStdOperatorTable.<clinit>(SqlStdOperatorTable.java:118)
       **               com.onwbp.org.apache.calcite.adapter.enumerable.RexToLixTranslator.<clinit>(RexToLixTranslator.java:93)
       **               java.lang.Class.forNameImpl(Native Method)
       **               java.lang.Class.forName(Class.java:348)
       **               java.lang.invoke.MethodType.nonPrimitiveClassFromString(MethodType.java:311)
       **               java.lang.invoke.MethodType.parseIntoClasses(MethodType.java:373)
       **               java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:286)
       **               java.lang.invoke.MethodHandle.getCPMethodTypeAt(Native Method)
       **               java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:849)
       **               ... 74 more
       **               Caused by: java.lang.ExceptionInInitializerError
       **               java.lang.J9VMInternals.ensureError(J9VMInternals.java:141)
       **               java.lang.J9VMInternals.recordInitializationFailure(J9VMInternals.java:130)
       **               java.lang.Class.forNameImpl(Native Method)
       **               java.lang.Class.forName(Class.java:348)
       **               java.lang.invoke.MethodType.nonPrimitiveClassFromString(MethodType.java:311)
       **               java.lang.invoke.MethodType.parseIntoClasses(MethodType.java:373)
       **               java.lang.invoke.MethodType.fromMethodDescriptorString(MethodType.java:286)
       **               java.lang.invoke.MethodHandle.getCPMethodTypeAt(Native Method)
       **               java.lang.invoke.MethodHandle.resolveInvokeDynamic(MethodHandle.java:849)
       **               ... 85 more
       **               Caused by: java.lang.NullPointerException
       **               com.onwbp.org.apache.calcite.sql.SqlCallBinding.<clinit>(SqlCallBinding.java:60)
       **               ... 92 more
       ****** 1 errors, 5 infos. 
      

      As we can see there is a NPE in SqlCallBinding:60, when it tries to call a method on SqlStdOperatorTable.DEFAULT, which seems to be null.

      According to the logs, what I think is happening is a circular dependency issue when classes get loaded (more details in first comment).
      However, so far I have only seen this error in WebSphere, in other environments the same application is correctly initialized and launched, and this exception does not happen.
      Since WebSphere uses IBM's own JVM, my hypothesis is that its class loader follows a different (and unlucky) order to load Calcite classes.

      So far I have not been able to reproduce the issue with a unit test, neither on Github CI, nor in a local environment.

      Attachments

        Issue Links

          Activity

            People

              rubenql Ruben Q L
              rubenql Ruben Q L
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m