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

java.lang.NoClassDefFoundError: org/apache/kafka/streams/processor/TopologyBuilder #2

Open
IDispose opened this issue Jan 3, 2018 · 0 comments

Comments

@IDispose
Copy link

IDispose commented Jan 3, 2018

This is the pom.xml I use

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.company.examples.streams</groupId> <artifactId>WordCountLambda</artifactId> <packaging>jar</packaging> <version>1.0</version> <name>WordCountLambda</name> <url>http://maven.apache.org</url> <properties> <java.version>1.8</java.version> <kafka.version>0.11.0.2</kafka.version> <avro.version>1.8.2</avro.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>3.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-clients</artifactId> <version>${kafka.version}</version> </dependency> <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka-streams</artifactId> <version>${kafka.version}</version> </dependency> <dependency> <groupId>org.apache.avro</groupId> <artifactId>avro</artifactId> <version>${avro.version}</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.3</version> <inherited>true</inherited> <configuration> <source>${java.version}</source> <target>${java.version}</target> <compilerArgument>-Xlint:deprecation</compilerArgument> </configuration> </plugin> </plugins> </build> </project>

Using Maven to build the example. No compilation issues. However running the sample like so

java -cp ~/.m2/repository/org/apache/kafka/kafka-clients/0.11.0.0/kafka-clients-0.11.0.0.jar:~/.m2/repository/org/apache/kafka/connect-json/0.11.0.2/connect-json-0.11.0.2.jar:~/.m2/repository/org/apache/kafka/kafka_2.11/1.1.0-SNAPSHOT/kafka_2.11-1.1.0-SNAPSHOT.jar:~/.m2/repository/org/apache/kafka/kafka-streams/0.11.0.2/kafka-streams-0.11.0.2.jar:~/.m2/repository/org/apache/kafka/connect-api/0.11.0.0/connect-api-0.11.0.0.jar:target/WordCountLambda-1.0.jar com.company.examples.streams.WordCountLambda

results in

Error: A JNI error has occurred, please check your installation and try again Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/kafka/streams/processor/TopologyBuilder at java.lang.Class.getDeclaredMethods0(Native Method) at java.lang.Class.privateGetDeclaredMethods(Class.java:2701) at java.lang.Class.privateGetMethodRecursive(Class.java:3048) at java.lang.Class.getMethod0(Class.java:3018) at java.lang.Class.getMethod(Class.java:1784) at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544) at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526) Caused by: java.lang.ClassNotFoundException: org.apache.kafka.streams.processor.TopologyBuilder at java.net.URLClassLoader.findClass(URLClassLoader.java:381) at java.lang.ClassLoader.loadClass(ClassLoader.java:424) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 7 more

Not sure what I am missing.

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

1 participant