Clojure "ClassNotFoundException" (deps.edn) in CI
The JVM could not load a Java class that Clojure code imported or interop-called. ClassNotFoundException names the fully qualified class; the JAR that provides it is absent from the classpath.
What this error means
A run fails with "Execution error ... Caused by: java.lang.ClassNotFoundException: com.example.Thing" during :import or interop.
clojure
Execution error (ClassNotFoundException) at ...
java.lang.ClassNotFoundException: org.postgresql.DriverCommon causes
The Java dependency is not on the classpath
A class referenced via :import or interop comes from a JAR not declared in :deps, so the loader cannot find it.
A driver or optional dependency was assumed present
A runtime class such as a JDBC driver is expected on the classpath but was never added for the CI run.
How to fix it
Add the providing JAR to deps.edn
- Read the fully qualified class in the exception.
- Add the library that ships it to
:deps. - Re-run so the class is on the classpath.
deps.edn
{:deps {org.postgresql/postgresql {:mvn/version "42.7.3"}}}Include runtime-only dependencies in CI
Ensure drivers and optional runtime JARs are present in the alias the CI job runs.
How to prevent it
- Declare runtime classes (drivers) explicitly in
:deps. - Run CI with the same alias that loads required JARs.
- Verify interop classes resolve before relying on them.
Related guides
Clojure "Could not locate X on classpath" (deps.edn) in CIFix Clojure "Could not locate X__init.class, X.clj or X.cljc on classpath" in CI - a require targets a namesp…
Clojure "Syntax error compiling: Unable to resolve symbol" in CIFix Clojure "Syntax error compiling at ... Unable to resolve symbol: X in this context" in CI - the compiler…
Clojure Leiningen "Could not find artifact" in CIFix Clojure Leiningen "Could not find artifact X in central/clojars" in CI - lein reached its repositories bu…