2

I created a Maven project that includes a dependency to the Calcite JDBC driver, as well as source code for a Calcite CSV adapter.

<dependency>
  <groupId>org.apache.calcite</groupId>
  <artifactId>calcite-core</artifactId>
  <version>1.20.0</version>
</dependency>

When I run from a JUnit test, I can query some CSV files using SQL. Very cool!

But I cannot get the JAR to work in SQL Workbench/J. The log file has this:

Caused by: java.lang.IllegalStateException: Unable to instantiate java compiler
 at org.apache.calcite.rel.metadata.JaninoRelMetadataProvider.compile(JaninoRelMetadataProvider.java:434)

Caused by: java.lang.ClassNotFoundException: No implementation of org.codehaus.commons.compiler is on the class path. Typically, you'd have 'janino.jar', or 'commons-compiler-jdk.jar', or both on the classpath.
 at org.codehaus.commons.compiler.CompilerFactoryFactory.getDefaultCompilerFactory(CompilerFactoryFactory.java:65)

SQL Workbench/J is successfully connecting, and I can see the list of CSV "tables" in the UI. But when I try to query them, I get the above error.

I found a link to someone having a similar problem, but did not see a resolution.

https://community.jaspersoft.com/questions/1035211/apache-calcite-jdbc-driver-jaspersoft

Also, here's the code that seems to be throwing the error:

public final
class CompilerFactoryFactory {
...
    public static ICompilerFactory
    getDefaultCompilerFactory() throws Exception {
        if (CompilerFactoryFactory.defaultCompilerFactory != null) {
            return CompilerFactoryFactory.defaultCompilerFactory;
        }
        Properties  properties = new Properties();
        InputStream is         = Thread.currentThread().getContextClassLoader().getResourceAsStream(
            "org.codehaus.commons.compiler.properties"
        );
        if (is == null) {
            throw new ClassNotFoundException(
                "No implementation of org.codehaus.commons.compiler is on the class path. Typically, you'd have "
                + "'janino.jar', or 'commons-compiler-jdk.jar', or both on the classpath."
            );
        }

From what I can tell, the org.codehaus.commons.compiler.properties resource is just not being found when running under SQL Workbench/J, but for some reason it works in my code.

If I unzip the JAR file, I do see org.codehaus.commons.compiler.properties in the directory structure, so not sure why it's not being found.

Anyone else run into this problem?

Thanks for any help.

RedTailedHawk
  • 189
  • 13

0 Answers0