sbt 0.13.0 JLine incompatibility detected - osx-lion

I have a problem with starting a play 2.2.0 app on my mac with mountain lion and java 7:
[ERROR] Terminal initialization failed; falling back to unsupported
java.lang.IncompatibleClassChangeError: Found class jline.Terminal, but interface was expected
at jline.TerminalFactory.create(TerminalFactory.java:101)
at jline.TerminalFactory.get(TerminalFactory.java:159)
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:85)
at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:79)
at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:40)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:54)
at sbt.StandardMain$.initialState(Main.scala:60)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
java.lang.IncompatibleClassChangeError: JLine incompatibility detected. Check that the sbt launcher is version 0.13.x or later.
at sbt.ConsoleLogger$.ansiSupported(ConsoleLogger.scala:96)
at sbt.ConsoleLogger$.<init>(ConsoleLogger.scala:79)
at sbt.ConsoleLogger$.<clinit>(ConsoleLogger.scala)
at sbt.GlobalLogging$.initial(GlobalLogging.scala:40)
at sbt.StandardMain$.initialGlobalLogging(Main.scala:54)
at sbt.StandardMain$.initialState(Main.scala:60)
at sbt.xMain.run(Main.scala:26)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:57)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:77)
at xsbt.boot.Launch$.run(Launch.scala:57)
at xsbt.boot.Launch$$anonfun$explicit$1.apply(Launch.scala:45)
at xsbt.boot.Launch$.launch(Launch.scala:65)
at xsbt.boot.Launch$.apply(Launch.scala:16)
at xsbt.boot.Boot$.runImpl(Boot.scala:32)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.IncompatibleClassChangeError: JLine incompatibility detected. Check that the sbt launcher is version 0.13.x or later.
It's not really linked to play since I got the same error when I start directly sbt in that directory.
So I tried a couple of things:
removed all sbt related stuff from my home dir and tried to use the sbt script from https://github.com/paulp/sbt-extras/blob/master/sbt -> same problem
removed all jars from my ivy repo dir and started again sbt -> same problem
downloaded a sbt launcher directly (version 0.13.0) -> same problem
tried with java 6 -> same problem
tried to debug sbt to figure out what's wrong but all I found out was that jline does not recognize that it should use a UnixTerminal (which I got working by setting systemProperties) but then again -> same error
It's somehow related to some strange linking I think because the class version for the terminal which should be used seems to be old. At least this is what the jvm is complaining about.
I tried it on a virtual box with ubuntu which worked fine so I think my system is a mess or I did something completely wrong.
Someone any ideas?

I had same problem. My project is using SBT 0.13
Turned out I need to upgrade SBT Launcher to 0.13 version as well.

If you start the JVM with verbose class loading enabled (-verbose:class), that might help troubleshoot where the offending JLine classes are coming from. Perhaps you have a JLine jar in one of your JVM extension directories, probably ~/Library/Java/Extensions or /System/Library/Java/Extensions.

This error can also happen if you use an SBT launcher from 0.12 in an SBT 0.13 project, as suggested in the error message.

Try updating SBT version to 0.13. Just download the sbt tar file and change the path in your .bash_profile file. Try again running sbt command in the project directory. That should fix the issue.

Related

sbt failed to start with NoClassDefFoundError

On a remote Windows 10 system sbt failes to start with a NoClassDefFoundError:
C:\WORKBENCH\BPF\my-project>sbt -Djavax.net.ssl.trustStoreType=WINDOWS-ROOT -Dsbt.boot.credentials="C:\WORKBENCH\BPF\my-project\credentials.txt" -Dsbt.boot.directory=C:\WORKBENCH\BPF\.sbt\boot -Dsbt.coursier.home=C:\WORKBENCH\BPF\coursier -v
# Executing command line:
"C:\Program Files (x86)\Java\jre1.8.0_321\bin\java.exe"
-Djavax.net.ssl.trustStore="C:\Program Files (x86)\Java\jre1.8.0_321\lib\security\cacerts"
-Djavax.net.ssl.trustStorePassword=changeit
-Xms1024m
-Xmx1024m
-Xss4M
-XX:ReservedCodeCacheSize=128m
-cp
"C:\Program Files (x86)\sbt\bin\sbt-launch.jar"
xsbt.boot.Boot
-Djavax.net.ssl.trustStoreType=WINDOWS-ROOT
-Dsbt.boot.credentials=C:\WORKBENCH\BPF\my-project\credentials.txt
-Dsbt.boot.directory=C:\WORKBENCH\BPF\.sbt\boot
-Dsbt.coursier.home=C:\WORKBENCH\BPF\coursier
java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to xsbti.FullReload
at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:59)
at sbt.xMain.run(Main.scala:46)
at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
at xsbt.boot.Launch$.run(Launch.scala:149)
at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
at xsbt.boot.Launch$.launch(Launch.scala:159)
at xsbt.boot.Launch$.apply(Launch.scala:44)
at xsbt.boot.Launch$.apply(Launch.scala:21)
at xsbt.boot.Boot$.runImpl(Boot.scala:78)
at xsbt.boot.Boot$.run(Boot.scala:73)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
[error] [launcher] error during sbt launcher: java.lang.ClassCastException: java.lang.NoClassDefFoundError cannot be cast to xsbti.FullReload
Tried with different SBT versions (1.6.2, 1.5.8, 1.4.9) by changing project/build.properties): The Stack Trace differs depending on the version, but it is always a NoClassDefFoundError.
The SBT version specified in the project is successfully downloaded by the launcher.
I suspect local file permission problems as cause (e.g. due to security policies) therefore i moved the boot and the coursier cache directory. However, this did not bring the desired success.
Does anyone have an idea what the Problem could be?
(I did not do much findings about it.) In my case i could fix it by changing to appropriate java version. Initially i ran with java 18v mistakenly and then changing to java 11v it worked.
I don't have a real diagnosis or causal explanation, but I did solve a similar problem (identical error message, Linux) by clearing out the sbt cache (the .sbt folder within your user directory).

Sudden problem with Apache log4j Appender when trying to launch SBT

I was executing a scala program with SBT and needed to stop the execution, so I hit Ctrl+c to end execution, which also ends the execution of SBT. I've done this a thousand times, but this time SBT wouldn't restart, and gives me this error:
java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/Appender
at sbt.StandardMain$.initialGlobalLogging(Main.scala:114)
at sbt.StandardMain$.initialState(Main.scala:136)
at sbt.xMain.run(Main.scala:70)
at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
at xsbt.boot.Launch$.run(Launch.scala:149)
at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
at xsbt.boot.Launch$.launch(Launch.scala:159)
at xsbt.boot.Launch$.apply(Launch.scala:44)
at xsbt.boot.Launch$.apply(Launch.scala:21)
at xsbt.boot.Boot$.runImpl(Boot.scala:78)
at xsbt.boot.Boot$.run(Boot.scala:73)
at xsbt.boot.Boot$.main(Boot.scala:21)
at xsbt.boot.Boot.main(Boot.scala)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.core.Appender
at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
... 14 more
[error] [launcher] error during sbt launcher: java.lang.NoClassDefFoundError: org/apache/logging/log4j/core/Appender
I tried installing a new version of SBT but that didn't work, and I get the same error.
I'm at a complete loss as to how to fix this problem. I really don't even know what the problem is. Thanks for any help.
I was able to get things working but I won't guarantee this would be a fix for everyone. Deleting my .sbt folder and restarting sbt worked. It created a new .sbt folder and everything is working correctly now. I only use sbt for compiling scala code so there isn't much that depends on sbt. Definitely back up your old .sbt folder if you're going to try this route.

sbt 1.2.8 throwing error in non sudo mode (fedora)

I have installed sbt 1.2.8 on fedora 29 following this instruction:
https://www.scala-sbt.org/1.0/docs/Installing-sbt-on-Linux.html
When I run sbt (don't matter if in project folder or any other place) I get:
java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)[Ljava/lang/Object;
at sbt.xMain.run(Main.scala:74)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:56)
at xsbt.boot.Boot$.main(Boot.scala:18)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.NoSuchMethodError: scala.Predef$.refArrayOps([Ljava/lang/Object;)[Ljava/lang/Object;
Running sbt with sudo privilages solves the problem. I have also tried downloading tgz package from sbt site and running
./bin/sbt
but with the same result (non sudo - error / sudo - everything ok).
Downgrading to 1.2.7 version also solves the problem but this is not a long term solution.
Do you have any idea what is going on ?
It's not a particularly satisfying answer, but I was able to solve this problem (also on Fedora 29) by deleting the ~/.sbt folder
I don't know what goes on in that folder, so maybe best to make a backup first. After it was deleted, I re-ran sbt and the folder was re-appeared, but sbt no longer crashed.

Import a Play Framework project to IntelliJ 14.1.5 Error

Problem:
IntelliJ is not letting me import a play framework project. It just displays errors when I try to open project using SBT.
Its really simple what I want to do, but I haven't used any of these tools and I'm a bit lost at how to fix this.
I just want to create a Play framework project, and edit it in IntelliJ as shown on multiple tutorials on youtube.
Below I have provided some info about how I have tried to make it work to "help you help me".
I really hope there is some easy solution that I fail to see!
Background info:
I have downloaded and installed IntelliJ 14.1.5 Community Edition and the latest avtivator from Play Framework - Activator 1.3.6 and Play 2.4.3
Note: I also downloaded the latest java jdk, 1.8.0_65 and added both java and activator to path - I'm using Windows 8. I have also downloaded the latest plugin of Scala inside IntelliJ
Then I opened cmd and typed "activator ui" and opened browser at localhost:8888 as instructed in tutorials. I managed to create a "play-java-intro" project. So far, so good.
After this I have tried a few different approaches.
NOTE: I have clicked "Invalidate cache / restart" each time I try something new
First try
I tried to Open project after I had created the project through activator. I selected root directory of the project and selected SDK jdk 1.7 (have tried with 1.8 aswell).
I got the error
Error while importing SBT project: ... at
sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:70) at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:65) at sbt.Using.apply(Using.scala:24) at sbt.MainLoop$.runWithNewLog(MainLoop.scala:65) at sbt.MainLoop$.runAndClearLast(MainLoop.scala:48) at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:32) at sbt.MainLoop$.runLogged(MainLoop.scala:24) at sbt.StandardMain$.runManaged(Main.scala:53) at sbt.xMain.run(Main.scala:28) at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) at xsbt.boot.Launch$.withContextLoader(Launch.scala:129) at xsbt.boot.Launch$.run(Launch.scala:109) at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36) at xsbt.boot.Launch$.launch(Launch.scala:117) at xsbt.boot.Launch$.apply(Launch.scala:19) at xsbt.boot.Boot$.runImpl(Boot.scala:44) at xsbt.boot.Boot$.main(Boot.scala:20) at xsbt.boot.Boot.main(Boot.scala) [error] java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0 [error] Use 'last' for the full log.
Inside the log file:
[info] Loading project definition from C:\play-java-intro\project
[info] Set current project to play-java-intro (in build file:/C:/play-java-intro/)
java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:800)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.typesafe.sbt.web.SbtWeb$$anonfun$com$typesafe$sbt$web$SbtWeb$$load$1.apply(SbtWeb.scala:535)
at com.typesafe.sbt.web.SbtWeb$$anonfun$com$typesafe$sbt$web$SbtWeb$$load$1.apply(SbtWeb.scala:535)
at scala.Option.fold(Option.scala:157)
at com.typesafe.sbt.web.SbtWeb$.com$typesafe$sbt$web$SbtWeb$$load(SbtWeb.scala:549)
at com.typesafe.sbt.web.SbtWeb$$anonfun$globalSettings$1$$anonfun$apply$1.apply(SbtWeb.scala:143)
at com.typesafe.sbt.web.SbtWeb$$anonfun$globalSettings$1$$anonfun$apply$1.apply(SbtWeb.scala:143)
at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
at sbt.Project$.setProject(Project.scala:319)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:484)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:475)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:475)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:58)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:58)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:60)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:60)
at sbt.Command$.process(Command.scala:92)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:98)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:98)
at sbt.State$$anon$1.process(State.scala:184)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:98)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:98)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.MainLoop$.next(MainLoop.scala:98)
at sbt.MainLoop$.run(MainLoop.scala:91)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:70)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:65)
at sbt.Using.apply(Using.scala:24)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:65)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:48)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:32)
at sbt.MainLoop$.runLogged(MainLoop.scala:24)
at sbt.StandardMain$.runManaged(Main.scala:53)
at sbt.xMain.run(Main.scala:28)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:129)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:36)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:19)
at xsbt.boot.Boot$.runImpl(Boot.scala:44)
at xsbt.boot.Boot$.main(Boot.scala:20)
at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
[error] Use 'last' for the full log.
I have tried to search what this means, but the answers I find on google wont apply to my problem.
I have tried to select and deselect all of the options within SBT - Use auto-import, Download sources and docs etc.. But still the same error message.
Second try
Similar to first try, but I clicked "Create IntelliJ project" inside activator at localhost:8888 and then tried to import the project the same method as First try.
Third try
Open project and select the root directory, and I managed to import the project somewhat, but its moved project files to "project backup" and I got lots of warnings saying its based on a outdated version. Didn't quite understand this.
Fourth try
Create project from existing sources after creating the project at activator, and I got the project imported without warnings.
But when I open Application.java (or any other file for that matter), everything inside that file gets red underlined with a error saying similar to "Cannot resolve symbol 'Result'" and I cant compile anything.
I have tried to open modules and click + and add Scala as a module, but it doesn't seem to make any difference.
I really hope there is someone out there that can help me as this should be a fairly easy thing to install IntelliJ + Play framework.
The issue is that even if IntelliJ is set to use JDK8, the SBT process is using JDK7 (you can confirm that looking at it with a tool like JVisualVM). Not sure what their logic is to pick up SBT's JVM, but you can force it when you import the projet:
This solved it for me with this version of Idea:
From the documentation: https://www.playframework.com/documentation/2.4.x/Highlights24
Play 2.4 now requires JDK 8
So you definitely must use only JDK 8.
Unsupported major.minor version 52.0
Means that you try to open project that was compiled with JDK 8 but your settings in IDE is JDK 7 (or less)
My proposition - check twice if you really use JDK8 in the intelliJ

Issue getting SBT to work on Mac OS X

I'm trying to use Miles Sabin's HList of his Shapeless project. So I installed sbt from Macports (this is version 0.11).
Unfortunately, when launching sbt, I have the following error message:
java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
at xsbt.boot.Boot$.runImpl(Boot.scala:24)
at xsbt.boot.Boot$.main(Boot.scala:15)
at xsbt.boot.Boot.main(Boot.scala)
Error during sbt execution: java.lang.IncompatibleClassChangeError: Expected static method scala.Predef$.refArrayOps([Ljava/lang/Object;)Lscala/collection/mutable/ArrayOps;
Search google seems to point that sbt-launch.jar would be in classpath. But even though I export CLASSPATH to "", I still have the issue.
I also directly downloaded the sbt-launch.jar from typesafe, and running with java -jar, with exactly the same problem.
Any idea? Other people having the same issue?
EDIT
I've tracked the problem down to a Java extension under ~/Library/Java/Extensions/scala-library.jar
I have removed it and the problem is gone. I think this has been installed by the TypeSafe stack (TBC).
I have had this error, and generally uninstalling Java, and installing it again will resolve it.
OP posted:
I've tracked the problem down to a Java extension under ~/Library/Java/Extensions/scala-library.jar
I have removed it and the problem is gone. I think this has been installed by the TypeSafe stack (TBC).