I spent a good chunk of my day trying to figure out why I couldn't get cider to work with my Clojure project in emacs.

This blog is both a workaround for fellow travelers and my "pastebin" details for the help I'm going to request to get this fixed

Background

At some point in the last couple of months OpenJdk stopped working with Cider. Whenever I tried to run cider-jack-in I got the following error:

error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (REPL:-1).
com.sun.source.doctree.BlockTagTree

Full report at:
/tmp/clojure-13021721334404602078.edn
 ("exited abnormally with code 1")
error in process sentinel: Could not start nREPL server: Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (REPL:-1).
com.sun.source.doctree.BlockTagTree

Full report at:
/tmp/clojure-13021721334404602078.edn
 ("exited abnormally with code 1")

Initial Troubleshooting

Oleksandr Yakushev in the Clojurians slack was quick to help me do some basic troubleshooting!

I had assumed com.sun.source.doctree.BlockTagTree was a dependency that was failing to be pulled but he informed me that this should have been built into the OpenJDK package. I tried several different versions of OpenJdk with guix shell (17,21,24) but Cider failed to start in all cases with the same error

I then tried to use icedtea with guix shell icedtea which worked but was too old for the project I'm working on.

This let me know that I needed to get a different binary.

Getting OpenJDK and Clojure from the source

I fetched OpenJDK from https://openjdk.org/projects/jdk/24/ and made it available on my path:

export JAVA_HOME=$HOME/jdk24
PATH=$JAVA_HOME/bin:$PATH
export PATH

and got Clojure from here https://clojure.org/guides/install_clojure

curl -L -O https://github.com/clojure/brew-install/releases/latest/download/linux-install.sh
chmod +x linux-install.sh
mkdir $HOME/clojure
sudo ./linux-install.sh --prefix $HOME/clojure

and made it available on my path:

PATH="$HOME/clojure/bin:$PATH"

Java Won't Run

When trying to run Java now I ran into a new issue. When I attempt to execute the Java binary I get:

./bin/java bash: ./bin/java: No such file or directory

The file was executable and did exist. Zie87's blog post was very useful for catching me up to speed on how some of this worked.

When I ran ldd on the binary this is what I got:

┌─[person@blep]──[20:41]──[/home/person/jdk24/bin]──[🤚]
└─> $ ldd java
	linux-vdso.so.1 (0x00007fd20d52d000)
	libjli.so => /home/person/jdk24/bin/../lib/libjli.so (0x00007fd20d510000)
	libz.so.1 => not found
	libdl.so.2 => /gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/libdl.so.2 (0x00007fd20d50b000)
	libpthread.so.0 => /gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/libpthread.so.0 (0x00007fd20d506000)
	libc.so.6 => /gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/libc.so.6 (0x00007fd20d328000)
	/gnu/store/hw6g2kjayxnqi8rwpnmpraalxi0djkxc-glibc-2.39/lib/ld-linux-x86-64.so.2 (0x00007fd20d52f000)
	libz.so.1 => not found

For some reason libz.so.1 was not being correctly linked.

Instead of modifying the binary I opted to just copy libz.so.1 to the java_home

First, I needed to find the library on the filesystem

┌─[person@blep]──[20:45]──[/home/person/jdk24/bin]──[🤚]
└─> $ guix locate libz.so.1
zlib@1.3             /gnu/store/3679z3xdyz7x8zrcwqzm86f9cf9i6p29-zlib-1.3/lib/libz.so.1
zlib@1.2.11          /gnu/store/8qv5kb2fgm4c3bf70zcg9l6hkf3qzpw9-zlib-1.2.11/lib/libz.so.1

and then just copied the file to the java_home:

mv /gnu/store/3679z3xdyz7x8zrcwqzm86f9cf9i6p29-zlib-1.3/lib/libz.so.1 $HOME/jdk24/lib

Conclusion

This got everything working and I'm able to hack on my Clojure project. However I think the best move going forward is going to be to ensure that com.sun.source.doctree.BlockTagTree is compiled with the Guix recipe for OpenJDK.

(need to look into how to do that…)