Does your jar contain the corresponding files?
You can check via `unzip -l target/streams.examples-0.1-shaded.jar |
grep StreamsBuilder`
If not, it seems your maven build is not set up correctly to assembly a
fat jar including all dependencies.
As your code compiles the dependency itself is specified correctly.
Otherwise, you would get an compile error on `mvn compile`
As an alternative, you can add the dependencies to you classpath
manually. Or you try our `bin/kafka-run-class` that helps setting up the
classpath.
-Matthias
On 2/12/18 10:10 AM, Darrel Riekhof wrote:
> I've been trying to run one of the kafka-streams tutorials out there.
> Currently trying
https://kafka.apache.org/10/documentation/streams/tutorial
>
> But I'm having problems getting my maven dependencies right:
>
> |
> java -cp target/streams.examples-0.1-shaded.jar myapps.Pipe
> Exceptioninthread
> "main"java.lang.NoClassDefFoundError:org/apache/kafka/streams/StreamsBuilder
> at myapps.Pipe.main(Pipe.java:29)
> Causedby:java.lang.ClassNotFoundException:org.apache.kafka.streams.StreamsBuilder
> at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
> at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>
> |
>
> I've included this, and various other kafka dependencies in my POM but
> it seems to be missing some required dep deep under the covers that
> StreamsBuilder and other classes in the kafka-streams jar need. Has
> anyone had this problem? OS is RH 7.3.
>
> |
> <dependency>
> <groupId>org.apache.kafka</groupId>
> <artifactId>kafka-streams</artifactId>
> <version>1.0.0</version>
> </dependency>
>
> |
>
>
> --
> You received this message because you are subscribed to the Google
> Groups "Confluent Platform" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to
confluent-platf...@googlegroups.com
> <mailto:
confluent-platf...@googlegroups.com>.
> To post to this group, send email to
confluent...@googlegroups.com
> <mailto:
confluent...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/confluent-platform/b4421cc5-24e9-4291-9696-26571fab51bf%40googlegroups.com
> <
https://groups.google.com/d/msgid/confluent-platform/b4421cc5-24e9-4291-9696-26571fab51bf%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit
https://groups.google.com/d/optout.