shizhengchao created FLINK-26527: ------------------------------------ Summary: ClassCastException in TemporaryClassLoaderContext Key: FLINK-26527 URL: https://issues.apache.org/jira/browse/FLINK-26527 Project: Flink Issue Type: Bug Components: Client / Job Submission Affects Versions: 1.14.3, 1.13.5 Reporter: shizhengchao
When I try to run sql using flink's classloader, I get the following exception: {code:java} Exception in thread "main" java.lang.ClassCastException: org.codehaus.janino.CompilerFactory cannot be cast to org.codehaus.commons.compiler.ICompilerFactory at org.codehaus.commons.compiler.CompilerFactoryFactory.getCompilerFactory(CompilerFactoryFactory.java:129) ……{code} my code is like this: {code:java} Configuration configuration = new Configuration(); configuration.set(CoreOptions.CLASSLOADER_RESOLVE_ORDER, "child-first"); List<URL> dependencies = FlinkClassLoader.getFlinkDependencies(System.getenv(ConfigConstants.ENV_FLINK_HOME_DIR)); URLClassLoader classLoader = ClientUtils.buildUserCodeClassLoader( dependencies, Collections.emptyList(), SessionContext.class.getClassLoader(), configuration); try (TemporaryClassLoaderContext ignored = TemporaryClassLoaderContext.of(classLoader)) { tableEnv.explainSql(sql); //CompilerFactoryFactory.getCompilerFactory("org.codehaus.janino.CompilerFactory"); } {code} But, if you change `classloader.resolve-order` to `parent-first`, everything works fine -- This message was sent by Atlassian Jira (v8.20.1#820001)