Fork me on GitHub

@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: 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?

Alex Miller (Clojure team)19:02:07

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( at clojure.lang.MultiFn.isA( at clojure.lang.MultiFn.findAndCacheBestMethod( at clojure.lang.MultiFn.getMethod( at clojure.lang.MultiFn.getFn( at clojure.lang.MultiFn.invoke( 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( 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( 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( 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( at clojure.lang.Var.applyTo( at clojure.main.main(


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


Maybe there is a race condition in initialization.


You may have some plugins set up somewhere. Are you sure you have clean everything in all possible place . See


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


Hi Andy! We ran into each other at a Conj. Back in the days of conferences!


Cool. Welcome here, and howdy.


But I am new to the Windows debacle.


Your error message suggests it tried to use the J9 JVM rather than the Adopt OpenJDK 11...


Hm! True. But it came from adoptopenjdk.


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.


Downloading Adoptopenjdk's "hotspot" variant now...


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 🙂


How bizarre.


I would still recommend looking at WSL2 for doing Clojure dev on Windows 10...


Now I am very curious whether Clojure is limited to just Hotspot.


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


Every one of them is Hotspot!


Do you remember the history there?


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.


My my, CLJ-2400 was declined because it was J9.


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


Oh good. I missed the "don't"

Alex Miller (Clojure team)19:02:30

I have tested with J9 in the past and did have some unusual test failures in the Clojure test suite

Alex Miller (Clojure team)19:02:17

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


I remember a difference in stack frames.

Alex Miller (Clojure team)19:02:54

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

Alex Miller (Clojure team)19:02:46

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


(but 2.9.5 looks like it bundles 1.10.x anyway


My my! Same thing happens in Linux. There is a hex on Leiningen & J9 version 11.


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: -- 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)


I might've missed it when updating the part on tests though


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 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?


oh yeah that would be great, let me find the url for the forum


(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!)