Could not retrieve sbt 0.13.9 on fresh Ubuntu install - scala

After a fresh install of Ubuntu 15.04, I attempted to install and run SBT using the instructions from www.scala-sbt.org. It installed fine, but when I run it for the first time, I get a bunch of errors:
~$ sbt
...
:::: 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/0.13.9/sbt-0.13.9.jar
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.scala-sbt#sbt;0.13.9: not found
Error during sbt execution: Error retrieving required libraries
(see /root/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.9
What is going wrong?

I have had same problem with xubuntu 15.10. I installed package ca-cacert:
sudo apt-get install ca-cacert
It solved this problem.

After a bit of debugging, I found that the cacerts file is missing from the latest version of OpenJDK.
All I had to do was copy the cacerts file from /etc/ssl/certs/java/cacerts from a working computer to my new workstation, and it worked fine.
I've made my file available at this link.

Related

module not found: org.scala-sbt#sbt;1.1.6

I installed SBT via terminal with following commands:
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
on my Ubuntu 18.04 and with java version:
openjdk version "1.8.0_171"
OpenJDK Runtime Environment (build 1.8.0_171-8u171-b11-0ubuntu0.18.04.1-b11)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)
The installation was successful but when I tried to start SBT via terminal, then I've got
https://repo.scala-sbt.org/scalasbt/ivy-snapshots/org.scala-sbt/sbt/1.1.6/ivys/ivy.xml
::::::::::::::::::::::::::::::::::::::::::::::
:: UNRESOLVED DEPENDENCIES ::
::::::::::::::::::::::::::::::::::::::::::::::
:: org.scala-sbt#sbt;1.1.6: 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.6/sbt-1.1.6.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.6/sbt-1.1.6.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.6/sbt-1.1.6.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.6/sbt-1.1.6.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.6/sbt-1.1.6.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.6/sbt-1.1.6.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.6/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.6/ivys/ivy.xml
What is wrong?
Update
developer#monad:~$ sudo apt-get purge openjdk-8-jdk java-common
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
openjdk-11-jre-headless : Depends: ca-certificates-java but it is not going to be installed
Depends: java-common (>= 0.28) but it is not going to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
List of installed java version:
developer#monad:~$ update-java-alternatives --list
java-1.11.0-openjdk-amd64 1101 /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
Update 2
sudo apt-get install ca-certificates-java
Reading package lists... Done
Building dependency tree
Reading state information... Done
ca-certificates-java is already the newest version (20170930ubuntu1).
ca-certificates-java set to manually installed.
The following packages were automatically installed and are no longer required:
libice-dev libsm-dev libxt-dev
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
The root cause is a conflict between openjdk-11-jdk (which is default in Ubuntu 18.04) and sbt packages settings. It has already been fixed in Debian and will be included in Ubuntu shortly. Meanwhile the simplest workaround is to demote your java to version 8. Other solutions employing ca-certificates-java are much more complicated.
First remove conflicting packages:
sudo apt-get remove --purge openjdk* java-common default-jdk
sudo apt-get remove --purge sbt
sudo apt-get autoremove --purge
Check weather you successfully removed all related packages by:
sudo update-alternatives --config java
The system shall prompt you there is no Java available to config, otherwise this workaround fails.
Then reinstall required packages:
sudo apt-get install openjdk-8-jdk sbt
Test by:
sbt compile
Problem is java-certificates so you need to run these commands:
Reinstall JDK
$ sudo apt-get purge openjdk-8-jdk java-common
$ sudo apt-get install openjdk-8-jdk
Run sbt
$ sbt
I would recommend you install Java/Scala/SBT totally independent from the OS packages. It does not matter (or should not matter!) for a developer which specific version of Java was installed by apt-get, yum or whatever.
From the developer's perspective, it may even make sense to test your application under several versions of Java. I've seen this situation before: "it works" under Java 1.8.x but "it fails" under Java 1.8.y.
So, from a developers, perspective, you would be interested on quickly swithing versions of Java, so that you can quickly make sure it works properly under those several different versions, no matter which specific version is installed on your specific version of the OS.
If you liked the idea, this is how it works:
Download manually all JDK versions you like and uncompress them under a given folder under your home folder, say: $HOME/tools. I have a script which automagically installs a certain version of the JDK for you: https://github.com/frgomes/bash-scripts/blob/master/scripts/user-install/install-java.sh
Adjust environment variables in a virtualenv-like fashion. It's easier than you think and you dont't even need virtualenv. All you need is to source a shell script which runs at login time which defines JAVA_HOME, pointing to a given version of Java, under your $HOME/tools. This is an example: https://github.com/frgomes/bash-scripts/blob/master/bashrc-virtualenvs/j8s12/bin/postactivate
Install Scala and SBT versions by hand, or using my automated script at https://github.com/frgomes/bash-scripts/blob/master/scripts/user-install/install-scala.sh
This fixed it for me.
sudo update-ca-certificates -f
In my case, I solved it by removing .m2, .ivy & .sbt.
Next time I executed sbt, it fixed everything.
I believe I broke sbt when I was playing with the cached dependencies or something else.

Why does sbt keep throwing this error whenever I run it?

Running any sbt command throws a java error -
"The java installation you have is not up to date
requires at least version 1.6+, you have
version 1.8"
This is after the last sbt update . I am unable to check the current sbt version because I run into the above mentioned error on running sbt sbt-version.
I had the same issue.
In my error output the first line is
/usr/share/sbt/bin/sbt-launch-lib.bash: line 207: bc: command not found
followed by your java error message
installing bc solved my issue
just add bc installation sudo apt install bc it will solve your issue
The issue has been fixed and sbt no longer requires bc to be installed.

Error in verifying sbt installation

I am new to Scala and have just downloaded sbt on my Mac.
After installing using the following command -
brew install sbt
i am trying to verify that the installation completed successfully by running this command -
sbt --version
I am expecting something like -
sbt launcher version 0.13.0
but getting the following instead -
sbt --version
[error] Not a valid command: version (similar: session)
[error] version
[error] ^
I have tried to uninstall and reinstall sbt on my machine but in vain.
Can someone let me know what I could be missing here?
thanks!
SBT launcher script simply doesn't support --version. Run sbt -h to see supported options. To show the SBT version used for current project, run sbt "show sbtVersion".

Error: Could not retrieve sbt 0.13.8

i have fresh ubuntu 15.04 and i installed sbt by this guide with
echo "deb http://dl.bintray.com/sbt/debian /" | sudo tee -a /etc/apt/sources.list.d/sbt.list
sudo apt-get update
sudo apt-get install sbt
then i just run command in terminal
sbt
output saying that sbt is trying to install (many many [SUCCESS] messages) and after all there are some error messages like
:: USE VERBOSE OR DEBUG MESSAGE LEVEL FOR MORE DETAILS
unresolved dependency: org.json4s#json4s-core_2.10;3.2.10: not found
unresolved dependency: org.spire-math#jawn-parser_2.10;0.6.0: not found
unresolved dependency: org.spire-math#json4s-support_2.10;0.6.0: not found
download failed: org.scalamacros#quasiquotes_2.10;2.0.1!quasiquotes_2.10.jar
Error during sbt execution: Error retrieving required libraries
(see /home/dima/.sbt/boot/update.log for complete log)
Error: Could not retrieve sbt 0.13.8
here is a full log from /home/dima/.sbt/boot/update.log
help please what should i do to fix this?
thanks
There are a number of errors like these in the logs:
SERVER ERROR: Connection timed out url=https://repo1.maven.org/maven2/org/scalamacros/quasiquotes_2.10/2.0.1/quasiquotes_2.10-2.0.1.pom.sha1
These suggest there was a (perhaps) temporary network issue. If you try the URL with get or curl do you see a similar error?

pecl install mongo command for mongo-1.5.5.tgz produce invalid tgz error

Overview
I was creating my Docker image to setup Rockmongo.
In the Dockerfile, I have a command
pecl install mongo
This command was working before but when ran t today I am getting this error,
downloading mongo-1.5.5.tgz ...
Starting to download mongo-1.5.5.tgz (Unknown size)
....done: 3,582 bytes
Could not get contents of package "/build/buildd/php5-5.3.10/pear-build-download/mongo-1.5.5.tgz". Invalid tgz file.
Download of "pecl/mongo" succeeded, but it is not a valid package archive
Error: cannot download "pecl/mongo"
Reference
To view the whole docker file
https://github.com/gilacode/docker-rockmongo/blob/master/Dockerfile
Question
Is there any way to specificy a different version of the Mongo package during the "pecl install command"?
I see this is an old question but anyway ...
I had the same issue and it was not due to the pecl website.
It seems to be a bug with the "lfs" option when you compile php5.
To verify if this is your case type: php-config --phpapi
I got it working by adding the --nocompress option
[sudo pecl install --nocompress mongo]
You can see other details here https://bugs.php.net/bug.php?id=67075