NoClassDefFoundError exception in uberjar

57 views
Skip to first unread message

Sezgin Aytaç

unread,
Aug 26, 2022, 5:17:27 AM8/26/22
to Luminus
Hi,

I have created guestbook project with luminus. I didn't add any code.
"lein run" command sucessfully runs the project.

Then I created the uberjar. But it gives
Exception: java.lang.NoClassDefFoundError thrown from the UncaughtExceptionHandler in thread "main"

I am missing some point. Any hint to overcome that problem?

Many thanks in advance.

Dmitri

unread,
Aug 26, 2022, 8:53:33 AM8/26/22
to Luminus
I'm not able to replicate this locally. Typically this would imply some conflict on the class path. It may be a plugin in your ~/.lein/profiles.clj

Sezgin Aytaç

unread,
Aug 26, 2022, 4:11:14 PM8/26/22
to Luminus
Hi Dimitri,

Many thanks for your kind and quick response.
Also, I have bought and I am studying your excellent book, thanks too.

After your response, I created a new pure lein project with "lein new app myapp", then created uberjar, it worked sucessfully.
Also one more thing as a hint: I tried to change
setDefaultUncaughtExceptionHandler in core.clj in order get more detail (e.g., stacktrace, etc) about the exception.
Even when I only change the handler message such that
" :where (str "**TEST** Uncaught exception on" (.getName thread) ..."
but nothing changed.

Best regards,
26 Ağustos 2022 Cuma tarihinde saat 15:53:33 UTC+3 itibarıyla Dmitri şunları yazdı:

Sezgin Aytaç

unread,
Aug 26, 2022, 4:31:01 PM8/26/22
to Luminus
Hi again,

Also, I have just tried your liberator-service project given in your book, the uberjar worked successfully.

Best regards,

26 Ağustos 2022 Cuma tarihinde saat 15:53:33 UTC+3 itibarıyla Dmitri şunları yazdı:
I'm not able to replicate this locally. Typically this would imply some conflict on the class path. It may be a plugin in your ~/.lein/profiles.clj

Dmitri

unread,
Aug 26, 2022, 4:52:02 PM8/26/22
to Luminus
Hi,

Glad you're liking the book. The error definitely looks like a wrong version of the class ending up on your classpath. Unfortunately there isn't enough info to figure out what's missing. One thing to check is that you're on the latest version of the jvm and lein.

Sezgin Aytaç

unread,
Aug 29, 2022, 4:54:11 AM8/29/22
to Luminus
Hi Dimitri,

My lein version was 2.9.9 (which is just one previous version)
I have upgraded to 2.9.10 (latest one)
It works  :D
I am very sorry due to make you busy and for your invaluable time.

Best regards,

26 Ağustos 2022 Cuma tarihinde saat 23:52:02 UTC+3 itibarıyla Dmitri şunları yazdı:

Dmitri

unread,
Aug 29, 2022, 8:40:33 AM8/29/22
to Luminus
No worries, glad we got this figured out.

James Elliott

unread,
Aug 29, 2022, 1:25:45 PM8/29/22
to Luminus
Ah! I am so glad I saw this discussion, because I ran into an identical problem when my Leiningen homebrew installation updated to version 2.9.9; it had been working fine before, and suddenly my Luminus project was not building jars correctly. I had to pin Leiningen to 2.9.8 on my other machine, and do a local manual installtion of 2.9.8 on the machine that had installed the broken update in order to get things working again. I had been planning to dig deeper when I had a bit more time, but now I can confirm that upgrading further to 2.9.10 has things working again as well.

“Fix a bug where dev-resources could leak into jars/uberjars. (Phil Hagelberg)”

Sezgin Aytaç

unread,
Aug 31, 2022, 2:57:15 AM8/31/22
to Luminus
Thanks so much for this feedback.

Best regards,

29 Ağustos 2022 Pazartesi tarihinde saat 20:25:45 UTC+3 itibarıyla brun...@gmail.com şunları yazdı:
Reply all
Reply to author
Forward
0 new messages