Skip to content
Latchkey

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.Driver

Common 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

  1. Read the fully qualified class in the exception.
  2. Add the library that ships it to :deps.
  3. 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

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →