mmolimar / ksql-jdbc-driver

JDBC driver for Apache Kafka
Apache License 2.0
87 stars 19 forks source link

Exception when trying to run simple test #5

Closed ThePickNick closed 5 years ago

ThePickNick commented 6 years ago

Hello I tried to test the driver out but When compiling the source "sbt compile" and try to run it "sbt run" to test I get Java.lang.runtimeExpection: no main class detected

when I package the code and try to run the simple Java app I get error with using the driver

Class.forname("com.github.mmolimar.ksql.jdbc.ksqldriver");

Exception in thread "main" Java.lang.NoClassDefFoundError: scala/ Function1 At java.lang.class.forname0(native method) At java.lang.class.forname(unknown source) ...

Did anyone stumble on similar issue and knows how to overcome it?

Thank you.

mmolimar commented 6 years ago

Have you tried with java.sql.DriverManager.registerDriver(new com.github.mmolimar.ksql.jdbc.KsqlDriver)?

bsmi021 commented 6 years ago

Getting the same error as ThePickNick; however, I'm getting it out of RazorSQL when trying to use the driver to query my ksql server, any ideas?

holgerbrandl commented 6 years ago

Same when using the produced driver jar in Intellij: image

Its most likely because the produced jar is not a fat-jar, i.e. is missing the internal dependencies of the driver. Not sure hot to fix that, because it's done in sbt.

soeirosantos commented 6 years ago

@ThePickNick, you may have to add the dependencies to your project. If you are using maven, it would be these two deps:

        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.11.11</version>
        </dependency>

        <dependency>
            <groupId>io.confluent.ksql</groupId>
            <artifactId>ksql-rest-app</artifactId>
            <version>4.1.0</version>
        </dependency>
mmolimar commented 5 years ago

Can you try with the new version? Build the jar executing sbt clean assembly.

holgerbrandl commented 5 years ago

I've tried with the fat-version of the current master, and the noclassdef error seems fixed.

mmolimar commented 5 years ago

Great!