Compatible SBT Version for Play 2.6 and Scala 2.12 - scala

I am using play 2.16.13 and Scala 2.12.6.
I am able to use SBT 0.13.8 and trying to upgrade to next version.
While using SBT 1.3.10, getting some error as below, Can someone please let me know the compatible version of SBT for the above mentioned play and scala.
[error] Server access Error: Connection timed out: connect url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/org.apache.commons/commons-parent/39/
[error] Server access Error: Connection timed out: connect url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/commons-io/commons-io/2.5/jars/common
[error] Server access Error: Connection timed out: connect url=https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/run-support_2.10/2.

The issue is because there was a older sbt used and i upgraded to a newer one. After deleting the .ivy2 and .sbt folder, it started working with latest sbt

Related

Unable to run the gatling test (jvm issue)

I am trying to run the gatling test on MacOS.
Java version: openjdk version "1.8.0_275"
scala version: 2.12.12
sbt version :1.4.4
I am unable to run my tests because of this error. I have tried changing the java versions(recommended one) and tried reinstalling the sbt as well.
The error log is as follows:
Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
[error] Could not accept connection from test agent: class java.net.SocketException: Socket closed
[error] java.net.SocketException: Socket closed
[error] at java.base/sun.nio.ch.NioSocketImpl.endAccept(NioSocketImpl.java:689)
[error] at java.base/sun.nio.ch.NioSocketImpl.accept(NioSocketImpl.java:762)
[error] at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:684)
[error] at java.base/java.net.ServerSocket.platformImplAccept(ServerSocket.java:650)
[error] at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:626)
[error] at java.base/java.net.ServerSocket.implAccept(ServerSocket.java:583)
[error] at java.base/java.net.ServerSocket.accept(ServerSocket.java:540)
[error] at sbt.ForkTests$Acceptor$1$.run(ForkTests.scala:71)
[error] at java.base/java.lang.Thread.run(Thread.java:832)
I would appreciate your feedback on this. Thank you.
There's no way you're using Java 8 as indicated, as your stacktrace clearly shows Jigsaw modules (java.base/). You're using Java 9 or older.
What happens is that the test forked JVM crashes on boot because it's being passed the AggressiveOpts option that was dropped after Java 8.
This option was removed in recent versions of Gatling's sbt plugin, meaning that you're using an older version.
In short: update your sbt plugin version.

Heroku error running Play: controllers/routes has been compiled by a more recent version of the Java Runtime

I am trying to run Play on Heroku...
The full error is:
play.api.UnexpectedException: Unexpected exception[RuntimeException: java.lang.UnsupportedClassVersionError: controllers/routes has been compiled by a more recent version of the Java Runtime (class file version 58.0), this version of the Java Runtime only recognizes class file versions up to 55.0] (58 is Java 14 and 55 is Java 11).
The Heroku help says:
Make sure you are using the correct JDK version by setting it in the system.properties file.
I added the following to system.proprties:
java.runtime.version=14.0.1.
And I can see it gets used by the Heroku compile. But I still get the error.
I thought that maybe the problem was the other way around so I also tried:
java.runtime.version=11.0.8
I also tried adding the following to application.conf
java.source=11.0.8
And for completeness java.source=14.0.1
When I run locally without Heroku (sbt compile stage) all is fine.
I have tried with the Play example from Heroku and also the Play example from Play (adding a procfile)... the result is the same.
The Play version is:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.8.2")
I tried putting in some older versions but Heroku failed to compile.
I went back to trying to get the Heroku version to run locally (rather than the other way around). From the resulting error message I found that sbt installed via brew adds a dependency to JDK 13:
SBT fails with `String.class is broken`
I followed the fix listed there and installed sbt using SDKMAN (instructions here:
https://www.scala-sbt.org/1.x/docs/Installing-sbt-on-Mac.html)
This got me to the next error which was due to "old SBT version":
java.lang.NullPointerException in project root running sbt
After fixing this, I can now run Play on Heroku and locally

SBT download error for ivy.xml although it exists

SBT:
[error] download error: Caught java.net.SocketException: Connection reset (Connection reset) while downloading
for example on **sbt-plugin**
https://repo.scala-sbt.org/scalasbt/sbt-plugin-releases/com.typesafe.play/sbt-plugi
n/scala_2.12/sbt_1.0/2.8.2/ivys/ivy.xml
But ivy.xml exists.
It happens for example on play-samples-2.8.x, with Scala 2.13.1, Play 2.8.2, SBT 1.3.8
Tkank you in advance, Marcin
I think this not a Scala, sbt or play framework related problem, but probably what the Java runtime reports. A glitch in the connection, somehow a change in your ip-address etc. Certainly Java runtime environment, connection or hardware.
Proszę dziękuję.

Compilation error in the Scala/Play example application for Heroku using Intellij

I am trying to compile the scala/Play framework example application on my local machine, but I am getting compilation errors when trying to compile using the SBT console in IntelliJ:
error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
I also got this message in the event log related to different SBT versions:
14:48 Started sbt shell with sbt version 0.13.18 instead of 0.13.11 configured by project.
Update sbt version
Disable version override
Any suggestions on how to fix this?
For the first error
error: scala.reflect.internal.MissingRequirementError: object java.lang.Object in compiler mirror not found.
You might want to try and ensure that you are using a compatible java version. Like #cbley suggested, try making you are using version 8 of the JDK.
For the second error
14:48 Started sbt shell with sbt version 0.13.18 instead of 0.13.11 configured by project.
Update sbt version
Disable version override
Its just suggesting you update the version of sbt (which is most likely declared in your build.properties file in a folder called project. You can just search for it by double tapping shift in IntelliJ. But you are safe to ignore it if you cloned some example repository as well.
check

play -help gives Error: Could not retrieve sbt 0.13.0: missing sbt.xMain

I created a new app using command play new hello and cd'ed into the directory. When I type play in the directory, I receive the following error:
akshay#Akshay:~/play/testn$ play -help
Java HotSpot(TM) Server VM warning: ignoring option MaxPermSize=512M; support was removed in 8.0
Getting org.scala-sbt sbt 0.13.0 ...
:: retrieving :: org.scala-sbt#boot-app
confs: [default]
0 artifacts copied, 43 already retrieved (0kB/45ms)
Error: Could not retrieve sbt 0.13.0: missing sbt.xMain
Play was working fine in my old Ubuntu box. Today only I got a fresh copy of Ubuntu 12.04 32 bit. I know it is error due to change in version, but certainly, I am not able to solve this. Please help me on this.
In checked .sbt/boot/update.log and I can see this :
trying http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
tried http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
HTTP response status: 404 url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
CLIENT ERROR: Not Found url=http://repo.typesafe.com/typesafe/ivy-releases/org.sonatype.oss/oss-parent/7/jars/oss-parent.jar
typesafe-ivy-releases: resource not reachable for org.sonatype.oss#oss-parent;7: res=http://repo.typesafe.com/typesafe/ivy-releases/org.$
trying http://repo1.maven.org/maven2/org/sonatype/oss/oss-parent/
Though error was coming from a fresh ubuntu installation with oracle jdk 8, I tried completely removing jdk and then installing jdk 7, but still no solution. Since it was a fresh installation, I reinstalled ubuntu and installed jdk 7 and problem is solved. Not sure why is it contradictory to Play's recomendation of using Jdk 6 or above. Notifying Play Google Groups about this.
I was getting the same error while trying to build using sbt-launcher.jar which was invoked through jenkins. In my case there were two Scala versions within ~/.sbt/boot/ and removing the older version solved the issue.
I was trying to setup my development environment for one of our projects when I hit this issue. The problem was the sbt.version parameter in the build.properties file of our project which specifically mentioned the version of sbt as 0.13.8 and I had sbt 0.13.11.
After removing sbt 0.13.11 and installing 0.13.8, the issue got resolved. Or if it is possible for you to change the sbt version in your build.properties file, you can do that as well.