Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ClassNotFoundException #27

Open
NitishDhok123 opened this issue Jun 9, 2020 · 3 comments
Open

ClassNotFoundException #27

NitishDhok123 opened this issue Jun 9, 2020 · 3 comments

Comments

@NitishDhok123
Copy link

NitishDhok123 commented Jun 9, 2020

confluent

I am trying to connect to ksqldb
public class MainClass {

public static void main(String[] args) {
	try {
		Class.forName("com.github.mmolimar.ksql.jdbc.KsqlDriver");
		KsqlDriver driver=new KsqlDriver();
		String url="jdbc:ksql://localhost:8089";
		
		KsqlConnection con=driver.buildConnection(KsqlDriver.parseUrl(url), null);
		Statement st=con.createStatement();
		ResultSet rs=st.executeQuery("select * from KSQLTEST");
		
		while(rs.next()) {
			System.out.println(rs.getString(0));
		}
	} catch (ClassNotFoundException | SQLException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}

}

but I m facing this issue
Exception in thread "main" java.lang.NoClassDefFoundError: io/confluent/ksql/rest/client/KsqlRestClient
at com.github.mmolimar.ksql.jdbc.KsqlConnection.init(KsqlConnection.scala:177)
at com.github.mmolimar.ksql.jdbc.KsqlConnection.(KsqlConnection.scala:163)
at com.github.mmolimar.ksql.jdbc.KsqlDriver.buildConnection(KsqlDriver.scala:71)
at com.torana.ksqldemo.MainClass.main(MainClass.java:21)
Caused by: java.lang.ClassNotFoundException: io.confluent.ksql.rest.client.KsqlRestClient
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 4 more

@mmolimar
Copy link
Owner

Hi.
Is the classpath properly set? I mean, all dependencies the driver has are included?

@NitishDhok123
Copy link
Author

yes can you tell me list of dependency that are need to connect

@mmolimar
Copy link
Owner

When you build the project with sbt clean assembly all deps are in the fat jar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants