Hi Ruben, Since you mentioned WebSphere I am wondering if it is related to some weird problem in the ClassLoader. If it was only a JVM problem I guess it could be reproduced outside of WebSphere just by referencing a few Calcite classes in some specific order.
Other than that, it is better to use JIRA when you have code and stacktraces; the formatting is helpful. Best, Stamatis On Thu, Nov 5, 2020 at 10:00 AM Ruben Q L <rube...@gmail.com> wrote: > Hello everyone, > > I'm getting a strange error on WebSphere 9 (on Ubuntu) when trying to start > an application that uses Calcite (shaded) library. The exception message > says: > > ** 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 [0]. > According to the logs, what I think is happening is a circular dependency > issue when classes get loaded [1]. > 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. > > Has anyone ever seen an issue like this? > Thanks, > Ruben > > WebSphere version is: > Integrated Solutions Console, 9.0.0.1 > Build Number: cf011636.02 > Build Date: 9/6/16 > > It uses java 8: > java version "1.8.0" > Java(TM) SE Runtime Environment (build pxa6480sr3fp11-20160817_02(SR3 > FP11)) > IBM J9 VM (build 2.8, JRE 1.8.0 Linux amd64-64 Compressed References > 20160816_315341 (JIT enabled, AOT enabled) > J9VM - R28_20160816_1459_B315341 > JIT - tr.r14.java.green_20160726_121883 > GC - R28_20160816_1459_B315341_CMPRSS > J9CL - 20160816_315341) > JCL - 20160816_01 based on Oracle jdk8u101-b13 > > [0] > > https://github.com/apache/calcite/blob/2e9edae7fc57ab9c9c7c097008724ac99a1791a3/core/src/main/java/org/apache/calcite/sql/SqlCallBinding.java#L60 > > [1] > *1) RexToLixTranslator.java* > > /*90*/ public class RexToLixTranslator implements > RexVisitor<RexToLixTranslator.Result> {/*91*/ public static final > Map<Method, SqlOperator> JAVA_TO_SQL_METHOD_MAP =/*92*/ > Util.mapOf(/*93*/ findMethod(String.class, "toUpperCase"), > SqlStdOperatorTable.UPPER,// --> LOAD SqlStdOperatorTable > > *2) SqlStdOperatorTable.java* > > /*118*/ public static final SqlMultisetSetOperator > MULTISET_UNION_DISTINCT =/*119*/ new > SqlMultisetSetOperator("MULTISET UNION DISTINCT", 14, false);// --> > LOAD SqlMultisetSetOperator > > *3) SqlMultisetSetOperator.java* > > /*42*/ public SqlMultisetSetOperator(String name, int prec, boolean > all) {/*43*/ super(/*44*/ name,/*45*/ > SqlKind.OTHER,/*46*/ prec,/*47*/ true,/*48*/ > ReturnTypes.MULTISET_NULLABLE,/*49*/ InferTypes.FIRST_KNOWN, // > --> LOAD InferTypes/*50*/ > OperandTypes.MULTISET_MULTISET);/*51*/ this.all = all;/*52*/ } > > *4) InferTypes.java* > > /*41*/ public static final SqlOperandTypeInference FIRST_KNOWN > =/*42*/ (callBinding, returnType, operandTypes) -> {/*43*/ > final RelDataType unknownType =/*44*/ > callBinding.getValidator().getUnknownType();/*45*/ RelDataType > knownType = unknownType;/*46*/ for (SqlNode operand : > callBinding.operands()) {/*47*/ knownType = > SqlTypeUtil.deriveType(callBinding, operand);/*48*/ if > (!knownType.equals(unknownType)) {/*49*/ break;/*50*/ > }/*51*/ } > // --> LOAD SqlCallBinding > > *5) SqlCallBinding.java* > > /*59*/ private static final SqlCall DEFAULT_CALL =/*60*/ > SqlStdOperatorTable.DEFAULT.createCall(SqlParserPos.ZERO);// > SqlStdOperatorTable is still loading in 2)! > SqlStdOperatorTable.DEFAULT in SqlStdOperatorTable:185 is null => NPE! >