21

I just installed Ubuntu 15.10 and their openjdk-8-jdk (by apt-get).

Now I am missing the cacerts file.

There is a link at the usual location:

ls -l /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts
lrwxrwxrwx 1 root root 27 Oct 22 01:47 /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/security/cacerts -> /etc/ssl/certs/java/cacerts

but nothing at /etc/ssl/certs/java/cacerts:

stat /etc/ssl/certs/java/cacerts
stat: cannot stat ‘/etc/ssl/certs/java/cacerts’: No such file or directory
4

3 回答 3

42

这是由于这里已经报告了一个错误: Ubuntu bug ticket

上面的票链接了另一个类似的问题,它提供了一种解决方法:

$ sudo dpkg --purge --force-depends ca-certificates-java
$ sudo apt-get install ca-certificates-java
于 2015-10-30T16:01:35.823 回答
1

只是在这里添加一个 Gergely 回答解决的错误,如果您尝试使用 ssl 调用外部 api 并收到此错误:

java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
javax.net.ssl.SSLException: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty
    at sun.security.ssl.Alerts.getSSLException(Alerts.java:208)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1946)
    at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1903)

这解决了

$ sudo dpkg --purge --force-depends ca-certificates-java
$ sudo apt-get install ca-certificates-java 
于 2020-02-16T14:23:57.003 回答
0

在 centos 你必须这样做:

$ sudo dnf install ca-certificates
于 2021-02-03T18:37:41.040 回答