Plain clojure 1.9 fails with Could not locate ... clojure/spec/alpha.clj on classpath. in Kubuntu 18.04

1,332 views
Skip to first unread message

Jesús Gómez

unread,
May 21, 2018, 12:17:37 PM5/21/18
to Clojure
Simply: 1.7 works but 1.9 not.

Test:

$ # Download Clojure 1.7, 1.8 and 1.9 jars
$ seq 7 9 | xargs -L1 -I% java -jar clojure-1.%.0.jar -e '"1.%.0 is Working"'
"1.7.0 is Working"
"1.8.0 is Working"
Exception in thread "main" java.lang.ExceptionInInitializerError
...
Caused by: java.io.FileNotFoundException: Could not locate clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath.
...

I've been trying to learn Clojure, so I've installed it in many ways:

 * Lein - Not working due some SSL credential
 * boot vian nix - Working but ... I don't remember the why already... something related with CIDR?... not important for this post anyways
 * via apt - Working but I can't make a simple clojure -m hello to work

So I tried to understand the basics (No maven, no 3rd parties, etc.) and found the mentioned problem.

I was expecting it to work flawless and to not be affected on what I got already installed in my system, but probably is the fact I installed clojure via APT, which installed 1.9.0, that is causing the jar for 1.9.0 to fail and not the others.

In any case... 1.9.0 jar is not working for me.

Thank you.

John Mastro

unread,
May 21, 2018, 12:59:15 PM5/21/18
to clo...@googlegroups.com
Jesús Gómez <jgo...@gmail.com> wrote:
> Simply: 1.7 works but 1.9 not.

> Test:

> $ # Download Clojure 1.7, 1.8 and 1.9 jars
> $ seq 7 9 | xargs -L1 -I% wget
http://repo1.maven.org/maven2/org/clojure/clojure/1.%.0/clojure-1.%.0.jar
> $ seq 7 9 | xargs -L1 -I% java -jar clojure-1.%.0.jar -e '"1.%.0 is
Working"'
> "1.7.0 is Working"
> "1.8.0 is Working"
> Exception in thread "main" java.lang.ExceptionInInitializerError
> ...
> Caused by: java.io.FileNotFoundException: Could not locate
clojure/spec/alpha__init.class or clojure/spec/alpha.clj on classpath.

Use the Linux installation script as described on the "geting started"
page[1]. This will also install Clojure's dependencies for you. The
installation script accepts a `--prefix` argument if you don't want to
install it globally.

[1]: https://clojure.org/guides/getting_started

Hope that helps

John

Alex Miller

unread,
May 21, 2018, 1:10:47 PM5/21/18
to Clojure
As of Clojure 1.9, the Clojure jar depends on two additional libraries (spec.alpha and core.specs.alpha). Using only the clojure jar is thus not sufficient. 

There are several ways to handle this, as described on the https://clojure.org/guides/getting_started page.

1. Use the new command line clj tools (linux install instructions on that page) - this will fetch the deps for you.
2. Do a local build into a single standalone jar (note this is a custom jar containing deps and is different than just the artifact you downloaded).
3. Use a build tool like leiningen or boot that will fetch the deps for you.
4. Download clojure and its deps manually and build your own custom classpath. (not recommended)

Jesús Gómez

unread,
May 21, 2018, 1:30:36 PM5/21/18
to clo...@googlegroups.com
I followed the Getting Started guide and nothing worked well, except
for the boot with nix installation.

The clj tools Linux instructions failed the same way the lein one
failed: Error with some certs [1]
I've been told that this problem could be solved if I install Oracle
Java instead of using OpenJDK. I don't want to do that.

I avoided the local build instructions because it was going to require
maven. I don't want to use it for now.

So, for now I'm working with the Clojure 1.8 jar.

I must say, Clojure is a good language, but the tooling is awful, not
userfriendly, not beginers friendly. Maven is a beast, is the only
thing had keped me away of Java for years, and now I must live with
it, Voluntarily (I'm learning Clojure not because the work, but
because I like it too much).

Probably I should try Clojurescript instead.

Thank you.

[1]
Could not transfer artifact
clojure-complete:clojure-complete:jar:0.2.4 from/to central
(https://repo1.maven.org/maven2/): java.lang.RuntimeException:
Unexpected error: java.security.InvalidAlgorithmParameterEx
ception: the trustAnchors parameter must be non-empty
.
.
.
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clo...@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Justin Smith

unread,
May 21, 2018, 1:38:37 PM5/21/18
to clo...@googlegroups.com
this is a problem with your distribution's config for installing the vm, on debian based systems it can be fixed by forcing reinstall of ca-certs, it does not require an oracle vm

Andy Fingerhut

unread,
May 21, 2018, 3:22:21 PM5/21/18
to clo...@googlegroups.com
Justin, I have tried doing these commands on an Ubuntu 18.04 LTS system (which I believe is Debian based):

% sudo apt-get --reinstall install ca-certificates
% sudo apt-get --reinstall install ca-certificates-java

Afterwards, the command "lein repl" still fails when using Ubuntu's OpenJDK8 or OpenJDK10 installations, and succeeds before and after with Oracle's JDK installations.

Is there some other command you would recommend to force reinstall of ca-certs that might work?

Andy



> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

Andy Fingerhut

unread,
May 21, 2018, 3:28:50 PM5/21/18
to clo...@googlegroups.com

Jesús:

Agreed that this issue is frustrating.  It doesn't necessarily help you here, but realize that this issue appears like it might be unique to Ubuntu 18.04's OpenJDK installations.

This issue did not occur with earlier versions of Ubuntu that I am aware of.


Andy


> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

Justin Smith

unread,
May 21, 2018, 4:05:12 PM5/21/18
to clo...@googlegroups.com
I should have been more specific. Just uninstalling leaves old configs around, and fixing this requires a full purge of the package.

these are my steps on a debian system:
$ sudo dpkg --purge --force-depends ca-certificates-java
$ sudo apt-get install ca-certificates-java

sourced from this stackoverflow answer


> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

Peter Hull

unread,
May 21, 2018, 4:22:58 PM5/21/18
to Clojure
On Monday, 21 May 2018 20:22:21 UTC+1, Andy Fingerhut wrote:
Is there some other command you would recommend to force reinstall of ca-certs that might work?

Specifically on the ca-certs thing, there is a bug filed with Ubuntu, and it looks like it should be fixed fairly soon;
(apologies if you already knew this)
Peter

Andy Fingerhut

unread,
May 21, 2018, 4:25:37 PM5/21/18
to clo...@googlegroups.com
Thanks, Justin.

I tried the commands you suggested on an Ubuntu 18.04 LTS system, and 'lein repl' still fails the same way afterwards when using Ubuntu's OpenJDK installation (and still succeeds when using Oracle's JDK installation).

Andy


> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

Justin Smith

unread,
May 21, 2018, 4:28:20 PM5/21/18
to clo...@googlegroups.com
oh, it seems that fix is for yet another ubuntu ca-certs java bug, I hadn't expected there were more


> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+u...@googlegroups.com.

Jesús Gómez

unread,
May 21, 2018, 7:18:10 PM5/21/18
to clo...@googlegroups.com
The simplest workaround I found in the bug report you  have shared here, is to configure Java to change the keystore type from pkcs12 to jks by simply editing the file `/etc/java-11-openjdk/security/java.security` and changing "keystore.type=pkcs12" to "keystore.type=jks" as it is explained in the fifth comment[1].

And then, follow the instructions given by Peter:

$ sudo dpkg --purge --force-depends ca-certificates-java
$ sudo apt-get install ca-certificates-java

Then both lein and clj works well.

I have to remember to rollback this change when the bug is fixed in Ubuntu.

Now I understand this is an Ubuntu exclusive problem, and I appreciate your help. Thank you.



> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clo...@googlegroups.com
Note that posts from new members are moderated - please be patient with your first post.
To unsubscribe from this group, send email to

For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups "Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages