Description
we have the Java.lang.NoSuchMethodError problem when using the default 3.1.6 version of Janino in a multi-threaded application, which works well with janino 3.1.4.
com.xsmartware.pbcm.sdk.PBCMException: Calcite ERROR:java.lang.NoSuchMethodError: org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)Lorg/codehaus/commons/compiler/ICompilerFactory;
at com.xsmartware.pbcm.policy.CalciteBasedVarGenerator.generateVariable(CalciteBasedVarGenerator.java:61) ~[classes/:?]
at com.xsmartware.pbcm.thread.VarGenThread.doCompute(VarGenThread.java:24) ~[classes/:?]
at com.xsmartware.pbcm.thread.VarGenThread.doCompute(VarGenThread.java:1) ~[classes/:?]
at com.xsmartware.pbcm.thread.PBCMBaseThread.run(PBCMBaseThread.java:38) [classes/:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]
Caused by: com.google.common.util.concurrent.ExecutionError: java.lang.NoSuchMethodError: org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)Lorg/codehaus/commons/compiler/ICompilerFactory;
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2053) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3966) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3989) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4950) ~[guava-31.0.1-jre.jar:?]
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.revise(JaninoRelMetadataProvider.java:187) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.RelMetadataQueryBase.revise(RelMetadataQueryBase.java:118) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.RelMetadataQuery.collations(RelMetadataQuery.java:604) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.RelMdCollation.project(RelMdCollation.java:291) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.logical.LogicalProject.lambda$create$0(LogicalProject.java:125) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.plan.RelTraitSet.replaceIfs(RelTraitSet.java:244) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:124) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:114) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.core.RelFactories$ProjectFactoryImpl.createProject(RelFactories.java:178) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.tools.RelBuilder.project_(RelBuilder.java:2025) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.tools.RelBuilder.project(RelBuilder.java:1797) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.tools.RelBuilder.projectNamed(RelBuilder.java:2088) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:3248) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:3151) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:702) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:664) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3548) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:589) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:259) ~[calcite-core-1.29.0.jar:1.29.0]
at com.xsmartware.common.calcite.CalciteDatabase.parseSql(CalciteDatabase.java:120) ~[classes/:?]
at com.xsmartware.common.calcite.CalciteDatabase.executeQuery(CalciteDatabase.java:104) ~[classes/:?]
at com.xsmartware.common.calcite.CalciteDatabase.exeGetLong(CalciteDatabase.java:139) ~[classes/:?]
at com.xsmartware.pbcm.policy.CalciteBasedVarGenerator.generateVariable(CalciteBasedVarGenerator.java:39) ~[classes/:?]
... 8 more
Caused by: java.lang.NoSuchMethodError: org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(Ljava/lang/ClassLoader;)Lorg/codehaus/commons/compiler/ICompilerFactory;
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.compile(JaninoRelMetadataProvider.java:152) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.generateCompileAndInstantiate(JaninoRelMetadataProvider.java:136) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.lambda$static$0(JaninoRelMetadataProvider.java:70) ~[calcite-core-1.29.0.jar:1.29.0]
at com.google.common.cache.CacheLoader$FunctionToCacheLoader.load(CacheLoader.java:169) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3533) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2282) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache$Segment.lockedGetOrLoad(LocalCache.java:2159) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache$Segment.get(LocalCache.java:2049) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache.get(LocalCache.java:3966) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache.getOrLoad(LocalCache.java:3989) ~[guava-31.0.1-jre.jar:?]
at com.google.common.cache.LocalCache$LocalLoadingCache.get(LocalCache.java:4950) ~[guava-31.0.1-jre.jar:?]
at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.revise(JaninoRelMetadataProvider.java:187) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.RelMetadataQueryBase.revise(RelMetadataQueryBase.java:118) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.RelMetadataQuery.collations(RelMetadataQuery.java:604) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.metadata.RelMdCollation.project(RelMdCollation.java:291) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.logical.LogicalProject.lambda$create$0(LogicalProject.java:125) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.plan.RelTraitSet.replaceIfs(RelTraitSet.java:244) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:124) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.logical.LogicalProject.create(LogicalProject.java:114) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.rel.core.RelFactories$ProjectFactoryImpl.createProject(RelFactories.java:178) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.tools.RelBuilder.project_(RelBuilder.java:2025) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.tools.RelBuilder.project(RelBuilder.java:1797) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.tools.RelBuilder.projectNamed(RelBuilder.java:2088) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.createAggImpl(SqlToRelConverter.java:3248) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertAgg(SqlToRelConverter.java:3151) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelectImpl(SqlToRelConverter.java:702) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertSelect(SqlToRelConverter.java:664) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQueryRecursive(SqlToRelConverter.java:3548) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.sql2rel.SqlToRelConverter.convertQuery(SqlToRelConverter.java:589) ~[calcite-core-1.29.0.jar:1.29.0]
at org.apache.calcite.prepare.PlannerImpl.rel(PlannerImpl.java:259) ~[calcite-core-1.29.0.jar:1.29.0]
at com.xsmartware.common.calcite.CalciteDatabase.parseSql(CalciteDatabase.java:120) ~[classes/:?]
at com.xsmartware.common.calcite.CalciteDatabase.executeQuery(CalciteDatabase.java:104) ~[classes/:?]
at com.xsmartware.common.calcite.CalciteDatabase.exeGetLong(CalciteDatabase.java:139) ~[classes/:?]
at com.xsmartware.pbcm.policy.CalciteBasedVarGenerator.generateVariable(CalciteBasedVarGenerator.java:39) ~[classes/:?]
... 8 more
we checked the janino release note page
http://janino-compiler.github.io/janino/changelog.html
Fixed issue #141: Unable to find org.codehaus.commons.compiler.properties in java 11: ICompilerFactories were loaded through the current thread's "context class loader", which is a bad choice in some environments. Thus, the methods "getDefaultCompilerFactory()", "getAllCompilerFactories()" and "getCompilerFactory(className)" were duplicated and augmented with a "classLoader" parameter.
It seems the getDefaultCompilerFactory method with a classloader parameter was removed intentionally, but calcite still needs it.
Attachments
Issue Links
- is related to
-
CALCITE-3745 CompileException in UnitCompiler when using multiple class loaders
- Closed