This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-02-07
Channels
- # announcements (6)
- # babashka (17)
- # beginners (72)
- # calva (27)
- # cider (26)
- # circleci (6)
- # clj-kondo (35)
- # cljdoc (3)
- # clojure (22)
- # clojure-australia (2)
- # clojure-dev (45)
- # clojure-france (2)
- # clojure-italy (2)
- # clojurescript (60)
- # conjure (16)
- # cursive (8)
- # datahike (10)
- # datascript (1)
- # datomic (3)
- # emacs (5)
- # fulcro (16)
- # graalvm (4)
- # honeysql (1)
- # joker (10)
- # luminus (3)
- # malli (7)
- # off-topic (28)
- # pathom (4)
- # pedestal (2)
- # polylith (1)
- # re-frame (6)
- # reagent (9)
- # reveal (4)
- # shadow-cljs (48)
- # slack-help (1)
- # tools-deps (30)
- # vim (24)
@qmstuart alright, i will check it out
@alexmiller what would you recommend besides 4Clojure
@thevastsilence Also see the gist linked in the topic of this channel: https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f. Oddly enough 4clojure is missing in the original post. /cc @yogthos
Trying to set up Leiningen (because deps for Windows is alpha and requires a Dot Net upgrade beyond what came with Windows 10.0.19042). "lein self-install" said it worked. But subsequent "lein" says NullPointerException. This is without any project.clj or profiles. I notice I do not yet have a .m2 directory. There is a stack trace on the NullPointerException, every frame starts with "clojure..." (not Leiningen). HowEver, I can do "java -cp .lein\self-installs\leiningen-2.9.5-standalone.jar clojure.main" and get a REPL prompt wherein "(clojure-version)" says 1.10.1. How could I troubleshoot the Leiningen?
lein.bat produces a NullPointerException while executing this line: "java" -client -Dfile.encoding=UTF-8 -Dclojure.compile.path="/target/classes" -Dleiningen.original.pwd="C:\Users\Idiot" -cp "C:\Users\Idiot\.lein\self-installs\leiningen-2.9.5-standalone.jar" clojure.main -m leiningen.core.main
You are welcome to copy and paste a full stack trace somewhere, preferably in a Slack discussion thread rather than at the "top level" for such verbose things, or link to one published elsewhere, in case it helps people determine what is going wrong. I do not know off hand of what the problem might be. I did want to note that at least some people use WSL or WSL2 on Windows, to get a more "greased path" for tools that work well on Linux.
According to the ("bottom" of the) stack trace, the cause of the NullPointerException from lein.bat is at clojure.main$report_error.invokeStatic(main.clj:601)! So perhaps something went wrong, and Clojure's usual practice of writing an "edn" file also went wrong, and the stack trace reflects only the failed attempt to write the edn?
I think that’s correct - looks like in pprint’ing the output to the tmp file, an error occurred
Exception in thread "main" java.lang.NullPointerException at clojure.core$reduce1.invokeStatic(core.clj:942) at clojure.core$into1.invokeStatic(core.clj:3421) at clojure.core$supers.invokeStatic(core.clj:5559) at clojure.core$isa_QMARK_.invokeStatic(core.clj:5577) at clojure.core$isa_QMARK_.invoke(core.clj:5564) at clojure.lang.Var.invoke(Var.java:393) at clojure.lang.MultiFn.isA(MultiFn.java:123) at clojure.lang.MultiFn.findAndCacheBestMethod(MultiFn.java:173) at clojure.lang.MultiFn.getMethod(MultiFn.java:150) at clojure.lang.MultiFn.getFn(MultiFn.java:154) at clojure.lang.MultiFn.invoke(MultiFn.java:229) at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194) at clojure.pprint$pprint_map$fn__11028$fn__11030.invoke(dispatch.clj:100) at clojure.pprint$pprint_map$fn__11028.invoke(dispatch.clj:100) at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:99) at clojure.pprint$pprint_map.invoke(dispatch.clj:94) at clojure.lang.MultiFn.invoke(MultiFn.java:229) at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194) at clojure.pprint$pprint_map$fn__11028$fn__11030.invoke(dispatch.clj:100) at clojure.pprint$pprint_map$fn__11028.invoke(dispatch.clj:100) at clojure.pprint$pprint_map.invokeStatic(dispatch.clj:99) at clojure.pprint$pprint_map.invoke(dispatch.clj:94) at clojure.lang.MultiFn.invoke(MultiFn.java:229) at clojure.pprint$write_out.invokeStatic(pprint_base.clj:194) at clojure.pprint$pprint$fn__10271.invoke(pprint_base.clj:249) at clojure.pprint$pprint.invokeStatic(pprint_base.clj:248) at clojure.pprint$pprint.invoke(pprint_base.clj:241) at clojure.pprint$pprint.invokeStatic(pprint_base.clj:245) at clojure.pprint$pprint.invoke(pprint_base.clj:241) at clojure.lang.Var.invoke(Var.java:384) at clojure.main$report_error$fn__9160$fn__9161.invoke(main.clj:603) at clojure.main$report_error$fn__9160.invoke(main.clj:602) at clojure.main$report_error.invokeStatic(main.clj:601) at clojure.main$main.invokeStatic(main.clj:666) at clojure.main$main.doInvoke(main.clj:616) at clojure.lang.RestFn.applyTo(RestFn.java:137) at clojure.lang.Var.applyTo(Var.java:705) at clojure.main.main(main.java:40)
You are trying to run the command lein repl
in a directory that contains no project.clj file at all?
Does lein version
give output, and if so what is that output? (or does it also give errors?)
Highly irregular. I repeated the "lein version" and this time I got "Execution error (NullPointerException) at cemerick.pomegranate/loading (pomegranate.clj:1). null. Full report at: ...Local\Temp\clojure-2516445834939944049.edn", and near the top of that file is this: {:via [{:type java.lang.ExceptionInInitializerError, :at [java.lang.J9VMInternals ensureError "J9VMInternals.java" 185]} {:type clojure.lang.Compiler$CompilerException, :message "Syntax error macroexpanding clojure.core/defn- at (cemerick/pomegranate/aether.clj:191:1)."
Then I tried "lein version" two more times, and got only the NPE with stack trace of only clojure frames.
You may have some plugins set up somewhere. Are you sure you have clean everything in all possible place . See https://www.github.com/technomancy/leiningen/tree/master/doc%2FPROFILES.md
It is a heretofore Java-free Windows 10. Today, I got VS Code and Leiningen and Java. In my .lein directory is nothing but self-installs. Leiningen has not made a .m2 directory yet.
I got the Java 11 from http://adoptopenjdk.org . Hoping that doesn't matter because in Windows I despair of achieving a clean uninstall.
I doubt that version of Java will cause you any troubles with Clojure.
i.e well supported and used by many.
Cool. Welcome here, and howdy.
Your error message suggests it tried to use the J9 JVM rather than the Adopt OpenJDK 11...
I think Sean is suggesting that you might have multiple JDKs installed on your system, and lein isn't using the AdoptOpenJDK 11 one.
As a fellow Windows 10 user, also using VS Code, I would strongly recommend at least considering enabling WSL2 and using that for all your Clojure development. Windows itself is very much a second-class citizen for Clojure work.
VS Code makes it seamless because it has a WSL2-Remote extension so you can use VS Code as normal on Windows but have all your Clojure files and REPL etc running on, say, Ubuntu on WSL2.
That way you'll be running Linux as far as Clojure is concerned and all the docs/tutorials/books will just work because they're all written for macOS/Linux, not Windows.
@seancorfield With the hotspot JVM, lein version says 2.9.5. No drama.
Excellent! Progress achieved 🙂
I would still recommend looking at WSL2 for doing Clojure dev on Windows 10...
You mentioned when invoking Java with lein on the class path worked. It might be worth it to see what lein.bat is doing. It should boil down to a command similar to that. Perhaps you could log some stuff in that if you’re interested
These are the JVMs that Clojure is tested on https://build.clojure.org/job/clojure-test-matrix/
I switched from Oracle 8 to Zulu 8 for a while, then Adopt OpenJDK 8, and I've stuck with OpenJDK versions ever since -- I'm using 15 in dev now. I don't think I've tried non-hotspot JVMs.
"I don't think it's actually specific to J9"
It seems it was declined because there's not actually a bug there -- type hinting is needed. Unless I'm misreading Alex's comment.
I have tested with J9 in the past and did have some unusual test failures in the Clojure test suite
I can’t remember if they were unusual because tests highlighted jvm differences (like hash ordering/reflector ordering kinds of things) or if it was something deeper
It would not surprise me at all if things like the locking verifier issue fixed in 1.10.2 would have shown up in J9
I don’t recall anything with stack map frames. Not saying you’re wrong, just don’t remember that.
The error mentions pomegranate, so the error is likely coming from the lein jvm, not the project jvm, so it will be using whatever (older) version of clojure is bundled with that version of lein
I feel like making an issue out recording this. In the name of Science purely. I think I will put the issue on the Leiningen project since that's the reproducible story I know.
If you want a more minimal test case you should see if it happens using clj (and deps.edn) loading the pomegranate library. You will be able to eliminate the two jvm thing in lein, and try it against different clojure versions (tricky to do in the lein jvm because lein bundles clojure)
Hello. I am following the book Web development with Clojure (3rd edition), and I have got stuck. The book showed me some database tests, but after typing them in I am getting an error trying to run them.
"Could not locate guestbook/test/db/core__init.class, guestbook/test/db/core.clj or guestbook/test/db/core.cljc on classpath."
@endrejoh that means it is looking for a namespace guestbook.test.db.core
which it would expect to find in guestbook/test/db/core.clj
under either your src
or test
folder.
Kind of unusual to have .test.
in the middle of a namespace though. Whereabouts are you in the book? I think I have a copy and can look at the examples...
Looks like it is referring to this file: http://media.pragprog.com/titles/dswdcloj3/code/guestbook/test/clj/guestbook/test/db/core.clj -- so it is expecting a file under your test/clj
folder, with a path guestbook/test/db/core.clj
According to the book, "The project already comes with some default test operations defined. These are found in the test folder of the application. The database tests are in the test/clj/guestbook/test/db/core.clj file."
I'm wondering if I'm using a newer version of the luminus template, so that the folder structure is a little bit different. The file with tests that came with my project was called core_test.clj, and it was inside this folder:
It looks like it is lacking one of the /test/ folders. I think the safe bet is to just create the project from scratch, and make sure I use the same version of the template as the book 🙂
Thank you for the help, @seancorfield!
Having test files ending in _test.clj
(and their namespaces ending in -test
) is a lot more common. I'm a bit surprised at what's in the book (mine is 3rd Ed, Beta 16 -- not sure what Ed you're reading?).
@yogthos Are we reading that section on tests correctly in your book?
(it's not day time for him but he should see that tomorrow and respond)
the book intends to follow this change in Luminus https://github.com/luminus-framework/luminus-template/pull/508
Yeah, that PR makes sense -- adding _test
to filenames (`-test` to namespaces). So it looks like that section of the book just hasn't caught up and the source code on http://media.pragprog.com still follows the old Luminus convention. Do you want me to go log that somewhere @yogthos? There's a forum for the beta book isn't there?
(In VS Code/Clover, I have a hot key bound to code that runs "associated tests" so when I'm in, say, guestbook.db.core
it would look for guestbook.db.core-test
--- note: no .test.
in the middle!)