How to fix “InvalidAlgorithmParameterException: th

2019-05-12 00:28发布

On a fresh Ubuntu 17.10 installation, I installed scala build tool (sbt) according to the docs:

echo "deb https://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 2EE0EA64E40A89B84B2DF73499E82A75642AC823
sudo apt-get update
sudo apt-get install sbt

Yet when running sbt, either just to get its version or to build a project, I get this error:

Getting org.scala-sbt sbt 1.1.0  (this may take some time)...

:: problems summary ::
:::: WARNINGS
        module not found: org.scala-sbt#sbt;1.1.0

    ==== local: tried

      /home/philipp/.ivy2/local/org.scala-sbt/sbt/1.1.0/ivys/ivy.xml

      -- artifact org.scala-sbt#sbt;1.1.0!sbt.jar:

      /home/philipp/.ivy2/local/org.scala-sbt/sbt/1.1.0/jars/sbt.jar

    ==== local-preloaded-ivy: tried

      file:////home/philipp/.sbt/preloaded/org.scala-sbt/sbt/1.1.0/ivys/ivy.xml

    ==== local-preloaded: tried

      file:////home/philipp/.sbt/preloaded/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

      -- artifact org.scala-sbt#sbt;1.1.0!sbt.jar:

      file:////home/philipp/.sbt/preloaded/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    ==== Maven Central: tried

      https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

      -- artifact org.scala-sbt#sbt;1.1.0!sbt.jar:

      https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    ==== sbt-maven-releases: tried

      https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

      -- artifact org.scala-sbt#sbt;1.1.0!sbt.jar:

      https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    ==== sbt-maven-snapshots: tried

      https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

      -- artifact org.scala-sbt#sbt;1.1.0!sbt.jar:

      https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    ==== typesafe-ivy-releases: tried

      https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/1.1.0/ivys/ivy.xml

    ==== sbt-ivy-snapshots: tried

      https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/1.1.0/ivys/ivy.xml

        ::::::::::::::::::::::::::::::::::::::::::::::

        ::          UNRESOLVED DEPENDENCIES         ::

        ::::::::::::::::::::::::::::::::::::::::::::::

        :: org.scala-sbt#sbt;1.1.0: not found

        ::::::::::::::::::::::::::::::::::::::::::::::


:::: ERRORS
    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.scala-sbt.org/scalasbt/maven-releases/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.pom

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.scala-sbt.org/scalasbt/maven-snapshots/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/1.1.0/ivys/ivy.xml

    Server access Error: java.lang.RuntimeException: Unexpected error: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must be non-empty url=https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/1.1.0/ivys/ivy.xml


:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;1.1.0: not found
Error during sbt execution: Error retrieving required libraries
  (see /home/philipp/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 1.1.0

This is my Java version:

$ java --version
openjdk 9-Ubuntu
OpenJDK Runtime Environment (build 9-Ubuntu+0-9b181-4)
OpenJDK 64-Bit Server VM (build 9-Ubuntu+0-9b181-4, mixed mode)

I have no idea what is happening. How to get sbt up and running again?

2条回答
爷的心禁止访问
2楼-- · 2019-05-12 01:05

In my case, I had to purge:

sudo apt purge openjdk-9-jdk openjdk-8-jdk java-common

(Just purging and reinstalling the jdk was not enough, I still had a java command after that. Only by purging java-common that also went away and then reinstallation worked.)

Afterwards, I reinstalled java again (I opted only for openjdk-9):

sudo apt install openjdk-9-jdk

This triggered: Running hooks in /etc/ca-certificates/update.d... and added a lot of cert files. Now my sbt built was succesful:

$ sbt
Getting org.scala-sbt sbt 1.1.0  (this may take some time)...
downloading https://repo1.maven.org/maven2/org/scala-sbt/sbt/1.1.0/sbt-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#sbt;1.1.0!sbt.jar (657ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/main_2.12/1.1.0/main_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#main_2.12;1.1.0!main_2.12.jar (4298ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/logic_2.12/1.1.0/logic_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#logic_2.12;1.1.0!logic_2.12.jar (185ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/actions_2.12/1.1.0/actions_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#actions_2.12;1.1.0!actions_2.12.jar (309ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/main-settings_2.12/1.1.0/main-settings_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#main-settings_2.12;1.1.0!main-settings_2.12.jar (1543ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/run_2.12/1.1.0/run_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#run_2.12;1.1.0!run_2.12.jar (397ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/command_2.12/1.1.0/command_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#command_2.12;1.1.0!command_2.12.jar (670ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/collections_2.12/1.1.0/collections_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#collections_2.12;1.1.0!collections_2.12.jar (517ms)
downloading https://repo1.maven.org/maven2/com/github/cb372/scalacache-caffeine_2.12/0.20.0/scalacache-caffeine_2.12-0.20.0.jar ...
    [SUCCESSFUL ] com.github.cb372#scalacache-caffeine_2.12;0.20.0!scalacache-caffeine_2.12.jar (96ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/io_2.12/1.1.3/io_2.12-1.1.3.jar ...
    [SUCCESSFUL ] org.scala-sbt#io_2.12;1.1.3!io_2.12.jar (479ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-logging_2.12/1.1.2/util-logging_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-logging_2.12;1.1.2!util-logging_2.12.jar (1161ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/librarymanagement-core_2.12/1.1.2/librarymanagement-core_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#librarymanagement-core_2.12;1.1.2!librarymanagement-core_2.12.jar (1813ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/librarymanagement-ivy_2.12/1.1.2/librarymanagement-ivy_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#librarymanagement-ivy_2.12;1.1.2!librarymanagement-ivy_2.12.jar (1679ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/compiler-interface/1.1.0/compiler-interface-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#compiler-interface;1.1.0!compiler-interface.jar (363ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-compile_2.12/1.1.0/zinc-compile_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-compile_2.12;1.1.0!zinc-compile_2.12.jar (113ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-relation_2.12/1.1.2/util-relation_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-relation_2.12;1.1.2!util-relation_2.12.jar (131ms)
downloading https://repo1.maven.org/maven2/com/eed3si9n/sjson-new-scalajson_2.12/0.8.2/sjson-new-scalajson_2.12-0.8.2.jar ...
    [SUCCESSFUL ] com.eed3si9n#sjson-new-scalajson_2.12;0.8.2!sjson-new-scalajson_2.12.jar (161ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-position_2.12/1.1.2/util-position_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-position_2.12;1.1.2!util-position_2.12.jar (146ms)
downloading https://repo1.maven.org/maven2/com/eed3si9n/sjson-new-core_2.12/0.8.2/sjson-new-core_2.12-0.8.2.jar ...
    [SUCCESSFUL ] com.eed3si9n#sjson-new-core_2.12;0.8.2!sjson-new-core_2.12.jar (930ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/completion_2.12/1.1.0/completion_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#completion_2.12;1.1.0!completion_2.12.jar (2066ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/task-system_2.12/1.1.0/task-system_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#task-system_2.12;1.1.0!task-system_2.12.jar (747ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/tasks_2.12/1.1.0/tasks_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#tasks_2.12;1.1.0!tasks_2.12.jar (299ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/testing_2.12/1.1.0/testing_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#testing_2.12;1.1.0!testing_2.12.jar (481ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-tracking_2.12/1.1.2/util-tracking_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-tracking_2.12;1.1.2!util-tracking_2.12.jar (161ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-classpath_2.12/1.1.0/zinc-classpath_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-classpath_2.12;1.1.0!zinc-classpath_2.12.jar (241ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-apiinfo_2.12/1.1.0/zinc-apiinfo_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-apiinfo_2.12;1.1.0!zinc-apiinfo_2.12.jar (524ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-ivy-integration_2.12/1.1.0/zinc-ivy-integration_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-ivy-integration_2.12;1.1.0!zinc-ivy-integration_2.12.jar (231ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc_2.12/1.1.0/zinc_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc_2.12;1.1.0!zinc_2.12.jar (267ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-control_2.12/1.1.2/util-control_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-control_2.12;1.1.2!util-control_2.12.jar (109ms)
downloading https://repo1.maven.org/maven2/net/java/dev/jna/jna/4.5.0/jna-4.5.0.jar ...
    [SUCCESSFUL ] net.java.dev.jna#jna;4.5.0!jna.jar (2551ms)
downloading https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/4.5.0/jna-platform-4.5.0.jar ...
    [SUCCESSFUL ] net.java.dev.jna#jna-platform;4.5.0!jna-platform.jar (2357ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-interface/1.1.2/util-interface-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-interface;1.1.2!util-interface.jar (87ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/util-cache_2.12/1.1.2/util-cache_2.12-1.1.2.jar ...
    [SUCCESSFUL ] org.scala-sbt#util-cache_2.12;1.1.2!util-cache_2.12.jar (238ms)
downloading https://repo1.maven.org/maven2/com/eed3si9n/sjson-new-murmurhash_2.12/0.8.2/sjson-new-murmurhash_2.12-0.8.2.jar ...
    [SUCCESSFUL ] com.eed3si9n#sjson-new-murmurhash_2.12;0.8.2!sjson-new-murmurhash_2.12.jar (97ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/test-agent/1.1.0/test-agent-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#test-agent;1.1.0!test-agent.jar (161ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-classfile_2.12/1.1.0/zinc-classfile_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-classfile_2.12;1.1.0!zinc-classfile_2.12.jar (225ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-compile-core_2.12/1.1.0/zinc-compile-core_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-compile-core_2.12;1.1.0!zinc-compile-core_2.12.jar (930ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-core_2.12/1.1.0/zinc-core_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-core_2.12;1.1.0!zinc-core_2.12.jar (705ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/zinc-persist_2.12/1.1.0/zinc-persist_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#zinc-persist_2.12;1.1.0!zinc-persist_2.12.jar (2494ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/core-macros_2.12/1.1.0/core-macros_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#core-macros_2.12;1.1.0!core-macros_2.12.jar (193ms)
downloading https://repo1.maven.org/maven2/org/scala-sbt/protocol_2.12/1.1.0/protocol_2.12-1.1.0.jar ...
    [SUCCESSFUL ] org.scala-sbt#protocol_2.12;1.1.0!protocol_2.12.jar (512ms)
downloading https://repo1.maven.org/maven2/com/github/cb372/scalacache-core_2.12/0.20.0/scalacache-core_2.12-0.20.0.jar ...
    [SUCCESSFUL ] com.github.cb372#scalacache-core_2.12;0.20.0!scalacache-core_2.12.jar (193ms)
:: retrieving :: org.scala-sbt#boot-app
    confs: [default]
    74 artifacts copied, 0 already retrieved (27445kB/73ms)
查看更多
我欲成王,谁敢阻挡
3楼-- · 2019-05-12 01:14

In my case on Ubuntu 18.04 bionic and sbt 1.1.6, forcing to reinstall ca-certificates-java fixes the problem as a workaround.

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

Be careful that --force-depends option doesn't damage your installation.

查看更多
登录 后发表回答