8000 Publish new release? Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory · Issue #37 · tatut/clj-chrome-devtools · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Publish new release? Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory #37

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

Open
danielcompton opened this issue Mar 19, 2025 · 0 comments

Comments

@danielcompton
Copy link
danielcompton commented Mar 19, 2025

When we add [clj-chrome-devtools "20220405"] to our app , we get an exception when we try to log in our AOT compiled app:

Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory

When I use clj-chrome-devtools as a git dependency, or build the JARs myself, I can't reproduce the issue. The one thing I saw that looked odd was that in the deployed JAR there is a user.clj file which doesn't appear to be present in the source.

(ns user
  (:require [clj-chrome-devtools.commands.page :as page]
            [clj-chrome-devtools.core :as chrome]
            [clj-chrome-devtools.automation :as auto]
            [clj-chrome-devtools.automation.launcher :as launcher]
            [clojure.java.io :as io])

  (:import (java.util Base64)))


(comment
  (defn b64-decode
    "https://stackoverflow.com/a/39188819/53790"
    [to-decode]
    (.decode (Base64/getDecoder) to-decode))

  (def a (launcher/launch-automation {}))
  ;(def c (chrome/connect "localhost" 9222))
  ;(def a (auto/create-automation c))
  (auto/to a "https://babashka.org")
  (auto/print-pdf a "bb.pdf")
  (def resp (page/print-to-pdf c {}))
  (def pdf-data (b64-decode (:data resp)))

  (with-open [out (io/output-stream "test.pdf")]
    (.write out pdf-data))

  (def scr (page/capture-screenshot c {:format "png"}))

  (with-open [out (io/output-stream "scr.png")]
    (.write out (b64-decode (:data scr)))))

When I add that user.clj file to the repository and lein install, I can reproduce the crash. I'm not 100% sure what is going on here, but I think there is likely some issue with the user.clj file and our AOT compiled app.

My best guess is that user.clj is loaded first at boot, which loads clj-chrome-devtools.automation.launcher :as launcher which then loads clojure.tools.logging, and somehow there is a class conflict from the AOT compiled defrecord vs the runtime compiled defrecord.

Would you consider doing a new release to Clojars? I prefer to use Maven dependencies over Git dependencies when they're available. Thanks!

@danielcompton danielcompton changed the title Publish new release? Publish new release? Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/logging/impl/LoggerFactory Mar 19, 2025
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
0