Git Product home page Git Product logo

Comments (19)

cemerick avatar cemerick commented on June 22, 2024

Maybe I missed something scrolling through the output, but how is Austin affecting AOT? Not to say I doubt that Austin is to blame, I just can't think of a way, and I don't see a mention of it in the stack, etc.

from austin.

danenania avatar danenania commented on June 22, 2024

I ran into the same issue in the early stages of a ring/compojure/http-kit app.

I added austin and everything was working fine, but then I ran a lein do clean and after this I started getting the same kind of stack trace that sgrove posted ending in Exception in thread "main" java.lang.NoClassDefFoundError: clojure/tools/reader/reader_types/Reader

I didn't realize that it had anything to do with austin until I asked for help in IRC, so I began selectively removing bits and pieces to see where the culprit was, and I narrowed it down to any calls involving middleware. Removing austin as a plugin fixed the issue.

from austin.

danenania avatar danenania commented on June 22, 2024

I should also note that I had austin in my :dev profile.

from austin.

cemerick avatar cemerick commented on June 22, 2024

Oh, I'll bet there's a version mismatch going on. What revs of ClojureScript, lein-cljsbuild, and austin are you using?

from austin.

danenania avatar danenania commented on June 22, 2024

austin: 0.1.3
clojurescript: 0.0-2030
lein-cljsbuild: 0.3.3

from austin.

sritchie avatar sritchie commented on June 22, 2024

Same issue here. Didn't realize this was Austin's doing.

from austin.

sritchie avatar sritchie commented on June 22, 2024

same here, with 1.0.0 lein-cljsbuild and cljs 2016. austin 0.1.3. Excluding org.clojurescript/clojurescript doesn't help either.

from austin.

sritchie avatar sritchie commented on June 22, 2024

My problem goes away if I run my uberjar with an explicit main class, instead of

java -cp myjar.jar clojure.main -m paddleguru.server

That was my mistake, as doing it this way double-compiles, causing issues with protocols.

My guess is that Austin includes some dep, maybe piggieback, that depends on cljs and has a (:gen-class) in the header and is compiling the tools.reader protocols.

from austin.

sritchie avatar sritchie commented on June 22, 2024

I managed to get around this by moving the plugin to dev, then using these two macros to add my dev calls to my code shared with production:

(defn try-require [sym]
    (try (require sym)
         (catch Throwable _
           (println "Namespace not available in current mode!" sym))))

  (defmacro maybe-resolve [ns method]
    `(when-let [n# (find-ns (quote ~ns))]
       (when-let [m# (ns-resolve n# (quote ~method))]
         @m#)))

from austin.

bellkev avatar bellkev commented on June 22, 2024

I'm having the same issue in this project: https://github.com/bellkev/dacom/tree/2a352a4da42993c046bc018a5dbf1b1080e959d4

Moving the plugin to the dev profile was a sufficient workaround for me.

from austin.

LiFlash avatar LiFlash commented on June 22, 2024

+1
Additionally I had to move the aot to my production profile. (Since I'm new to clojure I'm not sure if this makes sense)

from austin.

sritchie avatar sritchie commented on June 22, 2024

@LiFlash yup, that does make sense. I have it in my uberjar profile.

from austin.

LiFlash avatar LiFlash commented on June 22, 2024

@sritchie Thanks for the info. Hopefully I will understand what it is about (besides not delivering the source code), soon ;)

from austin.

cemerick avatar cemerick commented on June 22, 2024

I have a sneaking suspicion this is related to #37

Open to any and all ideas as to what's going on.

from austin.

blaenk avatar blaenk commented on June 22, 2024

Moving it to [:dev :plugins] does solve this issue for me, however, how do you guys go about building an uberjar of the project with :aot :all? To serve the javascript for austin I have:

[cemerick.austin.repls :refer [browser-connected-repl-js]]

but since austin is only in :dev, the uberjar build fails since it can't find the symbol.

from austin.

sritchie avatar sritchie commented on June 22, 2024

I do this for Weasel (same pattern worked for Austin):

(ns paddleguru.repl
  "Helpers for interacting with Austin: https://github.com/cemerick/austin"
  (:require [paddleguru.util :as u]))

(u/try-require 'cemerick.piggieback)
(u/try-require 'weasel.repl.websocket)

;; Use these to get the REPL running locally, connected to our live
;; server instance. For this to work you'll need to have started the
;; app from the repl itself.
(defn start! []
  (when-let [cljs-repl (u/maybe-resolve cemerick.piggieback cljs-repl)]
    (when-let [repl-env (u/maybe-resolve weasel.repl.websocket repl-env)]
      (cljs-repl :repl-env (repl-env)))))

Here are try-require and friends:

(s/defn try-require :- nil
    [sym :- Symbol]
    (try (require sym)
         (catch Throwable _
           (println "Namespace not available in current mode!" sym))))

  (defmacro maybe-resolve [ns method]
    `(when-let [n# (find-ns (quote ~ns))]
       (when-let [m# (ns-resolve n# (quote ~method))]
         @m#)))

That way I can have code that injects the repl snippet that works in dev mode, but just returns nil in prod.

from austin.

arohner avatar arohner commented on June 22, 2024

Complete speculation, but this might be related to: http://dev.clojure.org/jira/browse/CLJ-1544

I see CLJ-1544 when a namespace containing a protocol manages to get require'd before AOT starts.

from austin.

Bronsa avatar Bronsa commented on June 22, 2024

I have investigated http://dev.clojure.org/jira/browse/CLJ-1544 today and I can confirm this is the root cause for this ticket.

from austin.

cemerick avatar cemerick commented on June 22, 2024

Thanks so much for tracking this down, @Bronsa and @arohner, much appreciated!

from austin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.