Maven: trustAnchors parameter must be non-empty and 'parent.relativePath' @ InvalidAlgorithmParameterException @ Non-resolvable parent POM

喜夏-厌秋 提交于 2019-12-05 06:32:50
Tormod

According to what I found out there is a weakness in the distribution package on Ubuntu Linux for OpenJDK Java 9 and above. So installing default-jdk may break things.

Citation from: (https://bugs.launchpad.net/ubuntu/+source/openjdk-lts/+bug/1768799) + additional certificate updates.

Note that re-installing default-jdk is optional and openjdk-8 could be continually to be used.

Workaround: remove default-jdk, install openjdk-8, remove openjdk-8 and reinstall default-jdk:

sudo apt purge openjdk-default java-common

sudo apt purge default-jdk java-common

sudo dpkg --purge --force-depends ca-certificates-java

sudo apt install openjdk-8-jre

sudo apt-get install ca-certificates-java

sudo apt purge openjdk-8-jre

sudo apt install default-jdk

After this i also found out that the version of Spring I was using didn't run well on Java 10.0.1 so back to Java 8.x for that purpose.

Basically it is about ca-certificates-java. It is even more frustrating when you obtain the JDK outside linux distro repositories.

Here I got the clue from: http://rabexc.org/posts/certificates-not-working-java

I modified the bash script in the comment

CACERTS="/home/user/cacerts"
cd /etc/ssl/certs
for file in *.pem; do
   echo "Importing $file..."
   openssl x509 -outform der -in "$file" -out /tmp/certificate.der
   keytool -import -alias "$file" -keystore $CACERTS \
           -file /tmp/certificate.der -deststorepass changeit -noprompt
done

Modify the the first line to suit yourself. I run it on debian, for other system you might need to change the second line as well.

Then I copy the "cacerts" file into JDK which lies on $JAVA_HOME/jre/lib/security/cacerts

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!