Fork me on GitHub
#jackdaw
<
2022-12-15
>
Nick Dichev23:12:19

I’m brand new to clojure and trying to play around with jackdaw and I’m having a hell of a time just reading data off of a topic. I pulled the latest jackdaw into project.clj and when I start my repl I get this error and nothing in my namespace seems to be defined:

➜ lein repl
#error {
 :cause org.apache.kafka.streams.test.TestRecord
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message Syntax error macroexpanding at (jackdaw/data/producer.clj:7:1).
   :data #:clojure.error{:phase :execution, :line 7, :column 1, :source jackdaw/data/producer.clj}
   :at [clojure.lang.Compiler load Compiler.java 7665]}
  {:type java.lang.ClassNotFoundException
   :message org.apache.kafka.streams.test.TestRecord
   :at [java.net.URLClassLoader findClass URLClassLoader.java 476]}]
any ideas?

Sam H12:12:18

can you post your project.clj file? I have done the following: • lein new jackdaw-test • updated the project.clj to

(defproject jackdaw-test "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :url ""
  :license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
            :url ""}
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [fundingcircle/jackdaw "0.9.8"]]
  :repl-options {:init-ns jackdaw-test.core})
• and run lein repl • that dropped into jackdaw-test.core=> fine

Nick Dichev00:12:08

I was able to drop into a repl with just that as well, but as soon as I add a jackdaw reference into my namespace i get the error

Nick Dichev00:12:10

Workspace/tmp/jackdaw-test 
➜ cat src/jackdaw_test/core.clj  
(ns jackdaw-test.core
  (:require [jackdaw.client]))


Workspace/tmp/jackdaw-test 
➜ lein repl
#error {
 :cause org.apache.kafka.streams.test.TestRecord
 :via
 [{:type clojure.lang.Compiler$CompilerException
   :message Syntax error macroexpanding at (jackdaw/data/producer.clj:7:1).
   :data #:clojure.error{:phase :execution, :line 7, :column 1, :source jackdaw/data/producer.clj}
   :at [clojure.lang.Compiler load Compiler.java 7665]}
  {:type java.lang.ClassNotFoundException
   :message org.apache.kafka.streams.test.TestRecord
   :at [java.net.URLClassLoader findClass URLClassLoader.java 476]}]

Nick Dichev01:12:50

I’m not sure if its actually jackdaw or something wrong with how it pulled in/is loading the kafka libs?

jackdaw-test.core=> (import '(org.apache.kafka.streams.test TestRecord))
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:445).
org.apache.kafka.streams.test.TestRecord
I know nothing about how deps/loading works in java/clojure unfortunately

Sam H11:12:53

interestingly, this works in 0.9.4 but 0.9.5 has a change that causes this error: https://github.com/FundingCircle/jackdaw/pull/315

Sam H11:12:10

Found out that this is the dependancy that seems to help the tests pass: https://github.com/FundingCircle/jackdaw/blob/d29d651bf6845fed61a30fbc68e4d5775a3b5481/project.clj#L90 [org.apache.kafka/kafka-streams-test-utils "2.8.0"]

Nick Dichev18:12:06

Ah awesome, we came to the same discovery. I explicitly added that package to my deps and things started working 🙂 thanks for the help

👍 1
FiVo12:01:33

Also just ran into this.`[org.apache.kafka/kafka-streams-test-utils "2.8.0"]` needs be added to the main deps (currently only in the dev deps) othwise the library is broken.