Maven Error: (repeated) java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty

試著忘記壹切 提交于 2019-12-03 13:20:40

I had the same issue and it took me a day to solve it. This a java related issue as you may see in the error stack. Check in:

/etc/ssl/certs/java for the cacerts file.
1) If you don't have this file here that is the reason why your getting this error
2) If you do have this file here it means that this is probably not a valid cacerts file.

If you want you can update it with:
sudo apt-get install --reinstall ca-certificates
And if it works now, then perfect (in my case it did not work)

So to solve this:

  1. Download from open-jdk8 (in my case) directly from oracle
  2. Extract the tar.gz files
  3. Find the new valid cacerts file under jre/lib/security
  4. Copy this file to /etc/ssl/certs/java (removing the old one if that is your case)

Finally run the comand that caused you this error and hopefully its gone! Hope this helped.

Cheers

Today I found the reason:

Way back in history I once had set the WINDOWS environment variable MAVEN_OPTS by "setx MAVEN_OPTS "-Djavax.net.ssl.trustStore....".

The path specified here does no longer exist.

It seems this setting supersedes even the request showed in my question. I consider this behaviour to be at least unexpected but anyway. When I fixed the environment variable (pointing to the new path; but I'm going to delete it anyway) the mvn-requests worked fine.

The fact that the invalid parameter in the environment was not overruled with the trustStore setting on the commandline, was probably due to the fact that there is a typo in your commandline. It says:

-Djava.net.ssl.trustStore=...

But this should have been:

-Djavax.net.ssl.trustStore=...

a more ez way to fix this problem: 1.go to download Corretto OpenJDK published by Amazon 2.install it according to its guide. 3.set to use this Java DK.

problem fixed in my Ubuntu 18.

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