I am getting below error while creating package in intellij. I have case class with many parameters around 240 columns.
Error:
s
cala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5423)
[error] at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5370)
[error] at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5374)
[error] at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5472)
[error] at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5478)
[error] at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:4812)
[error] (compile:compileIncremental) java.lang.StackOverflowError
[error] Total time: 31 s, completed Jan 12, 2019 11:00:53 PM
I have already updated vmoption file as below but this error is still coming.
# custom IntelliJ IDEA VM options
-Xms30G
-Xmx30G
-Xss30G
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
I already updated my vmoption file with below parameters and updated Xss and Xmx in settings.
# custom IntelliJ IDEA VM options
-Xms30G
-Xmx30G
-Xss30G
-XX:ReservedCodeCacheSize=240m
-XX:+UseConcMarkSweepGC
-XX:SoftRefLRUPolicyMSPerMB=50
-ea
-Dsun.io.useCanonCaches=false
-Djava.net.preferIPv4Stack=true
-Djdk.http.auth.tunneling.disabledSchemes=""
-XX:+HeapDumpOnOutOfMemoryError
-XX:-OmitStackTraceInFastThrow
I have compiled the code and I am not getting any error in compile but when I create package I am getting this error.
I got he answer I have to update sbt file in my program file with -Xss2G and -Xmx2G and it worked.
I was confused earlier by Pawan's answer but what I believe he meant is this setting in IDEA Intellij ( and not the SBT file itself )
Intellij IDEA > Preferences > Build,Execution,Deployment > Build Tools > sbt
you can set following:
-Xss8m
The most confusing thing here is that it seems that this is different from Scala Compiler Server ( for which I tried a lot of combinations and even tried changing the underlying JDK and what not ) but the key was that that the sbt shell was not getting affected by those changes
/Library/Java/JavaVirtualMachines/jdk-12.0.2.jdk/Contents/Home/bin/java -server -Xmx1536M -Dsbt.supershell=false -Xss8m -Didea.managed=true -Dfile.encoding=UTF-8 ....
thus i searched for SBT properties.
Related
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).
Probably this is very silly question with simple solution...
I read a lot of manuals how to use local repositories but in my case sbt keeps using remote ones.
When I try to override system properties in command line while starting sbt I'm getting following
C:\Users\dummy\IdeaProjects\sbt_2021>sbt -Dsbt.repository.config=C:/Users/dummy/.sbt/repositories
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Warning: invalid system property 'sbt.repository.config'
[info] Loading project definition from C:\Users\dummy\IdeaProjects\sbt_2021\project
[info] Set current project to sbt_2021 (in build file:/C:/Users/dummy/IdeaProjects/sbt_2021/)
[error] Expected key
[error] Expected '*'
[error] C:/Users/dummy/.sbt/repositories
[error] ^
C:\Users\dummy\IdeaProjects\sbt_2021>sbt -Dsbt.override.build.repos=true
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
Warning: invalid system property 'sbt.override.build.repos'
[info] Loading project definition from C:\Users\dummy\IdeaProjects\sbt_2021\project
[info] Set current project to sbt_2021 (in build file:/C:/Users/dummy/IdeaProjects/sbt_2021/)
[error] Not a valid command: true
[error] Not a valid project ID: true
[error] Expected ':' (if selecting a configuration)
[error] Not a valid key: true (similar: run, runner, target)
[error] true
[error] ^
Tried on two differnt computers with sbt version 0.13.7 and 1.0.0
Any help is highly appreciated!
It works well if I specify system properties as part of env variable SBT_OPTS.
In command line it also works but only if I specify sbt system properties in double quotes.
PS. When I specify java system properties in command line with -Dpropery=value I do not have to use double quotes though.
I have been facing this error for sometime now. Totally irritated because of this. Tried all the similar solutions seen in stackoverflow and other sites.
I have a 4 separate scala projects. Out of those, I am getting StackOverflow error on compilation of tow projects. These two projects are the biggest ones out of the 4 projects.
I am getting this error when I try to build the project in Ubuntu Server machine. I tried increasing the Xmx options in sbt config file, but with no success.
Can anyone please help me to solve this, as I am going mad because of this. If I build the project 10 times, it will get succeeded in 1 or 2 attempts.
What I understood from the error log is that the issue comes with type checking. But, I have no idea where that occurs.
One of the failing projects have over 1000 classes/traits (without including case classes).
Details:
Ubuntu Server(14)
Sbt : 0.13.6 and 0.13.8 tried
Scala Version : 2.11.6
JDK: 1.8
A few lines of the error is pasted below:
java.lang.StackOverflowError
at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:696)
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5396)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5423)
at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5370)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5374)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$96.apply(Typers.scala:4523)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$96.apply(Typers.scala:4523)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:680)
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4522)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4578)
at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5343)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5360)
at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:696)
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5396)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5423)
at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5370)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5374)
at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5472)
at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5480)
at scala.tools.nsc.transform.Erasure$Eraser.adaptMember(Erasure.scala:642)
at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:696)
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5396)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5423)
at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5370)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5374)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$96.apply(Typers.scala:4523)
at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$96.apply(Typers.scala:4523)
at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:680)
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4522)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4578)
at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5343)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5360)
at scala.tools.nsc.transform.Erasure$Eraser.typed1(Erasure.scala:696)
at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5396)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5423)
at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5370)
at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5374)
at scala.tools.nsc.typechecker.Typers$Typer.typedArg(Typers.scala:3163)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$class.typedArgWithFormal$1(PatternTypers.scala:112)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$$anonfun$2.apply(PatternTypers.scala:115)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$$anonfun$2.apply(PatternTypers.scala:115)
at scala.runtime.Tuple2Zipped$$anonfun$map$extension$1.apply(Tuple2Zipped.scala:46)
at scala.runtime.Tuple2Zipped$$anonfun$map$extension$1.apply(Tuple2Zipped.scala:44)
at scala.collection.immutable.List.foreach(List.scala:381)
at scala.runtime.Tuple2Zipped$.map$extension(Tuple2Zipped.scala:44)
at scala.tools.nsc.typechecker.PatternTypers$PatternTyper$class.typedArgsForFormals(PatternTypers.scala:115)
at scala.tools.nsc.typechecker.Typers$Typer.typedArgsForFormals(Typers.scala:111)
at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$handleMonomorphicCall$1(Typers.scala:3469)
at scala.tools.nsc.typechecker.Typers$Typer.doTypedApply(Typers.scala:3494)
at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4544)
at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4578)
at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5343)
at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5360)
at scala.tools.nsc.transform.Erasure$Eraser.typed1(E
This has been affecting Scala since 2.11.4 till 2.11.6 afaik. It doesn't appears as fixed on the latest release notes for 2.11.7.
Fortunately following the track on the issue tracker it's a duplicated ticket with an answer here on stack overflow
Without the source code is harder to give more indications but that should definitely be a good pointer to find the issue and apply the proposed solution
I tried all the configuration changes, but didn't work in the machine. So I had skipped this for almost a month. Recently, I tried building the project in Jenkins and was getting the same error. Then I upgraded sbt 0.13.8 and added the jvm flag -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256m -Xmx1024M -Xss16M to the jenkins build flag. And so far, all the compilations have been successful.
I remember adding the jvm flag to sbt config file, but was getting the same error. But now, it is working fine in jenkins after adding that flag.
I tried running my scala project with CLI arguments using sbt launcher version 0.12.1. It works OK when run from the scala prompt:
$ sbt
[info] (...)
> run sth
(...)
[success] Total time: 0 s, completed Nov 9, 2012 3:04:47 PM
But when I want to run it whole from shell, as per this answer for example, I'm getting an error:
$ sbt "run sth"
[info] (...)
you need to provide source file name
[success] Total time: 0 s, completed Nov 9, 2012 3:07:07 PM
[error] Not a valid command: sth (similar: set, last, shell)
[error] Expected '/'
[error] Expected ':'
[error] Not a valid key: sth (similar: test, state, watch)
[error] sth
[error] ^
And the "you need to provide source file name" info is given by my scala project to indicate that main didn't get any CLI arguments.
Is it something that worked in the previous version of sbt (in the referenced question), or am I doing something wrong?
The problem could be the way you pass arguments in your sbt launch file to Java. In my case it is:
java -Xmx4096M -jar `dirname $0`/sbt-launch_0.12.1.jar "$#"
And I just confirmed: It works with both 0.12 and 0.12.1. For instance, for a program that just prints its arguments I get:
$ sbt "run-main SomeMain blah blah"
Outut:
[blah, blah]
By using run-main you can also avoid the possibility that sbt somehow does not see your main function.
That's a bug in the 0.12.1 launcher: https://github.com/sbt/sbt-launcher-package/issues/34
I am using http://typesafe.com/stack/ for the first time, and I created simple akka project. My scala version is 2.9.2 I get the following error.
[info] Done updating.
[info] Compiling 1 Scala source to /Users/hrishikeshparanjape/git-public/web-service/target/scala-2.9.2/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.9.2. Compiling...
sbt appears to be exiting abnormally.
The log file for this session is at /var/folders/26/hqgjyf0j7192hmjdsz17f3v80000gn/T/sbt2587622650679130928.log
java.lang.OutOfMemoryError: PermGen space
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
at java.util.concurrent.FutureTask.get(FutureTask.java:83)
at sbt.CompletionService$$anon$1.take(CompletionService.scala:29)
at sbt.Execute.next$1(Execute.scala:74)
at sbt.Execute.processAll(Execute.scala:77)
at sbt.Execute.runKeep(Execute.scala:57)
at sbt.EvaluateTask$.run$1(EvaluateTask.scala:109)
at sbt.EvaluateTask$.runTask(EvaluateTask.scala:124)
at sbt.Aggregation$$anonfun$7.apply(Aggregation.scala:87)
at sbt.Aggregation$$anonfun$7.apply(Aggregation.scala:85)
at sbt.EvaluateTask$.withStreams(EvaluateTask.scala:87)
at sbt.Aggregation$.runTasks(Aggregation.scala:85)
at sbt.Aggregation$$anonfun$applyDynamicTasks$1.apply(Aggregation.scala:141)
at sbt.Aggregation$$anonfun$applyDynamicTasks$1.apply(Aggregation.scala:136)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:64)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:64)
at sbt.Command$.process(Command.scala:92)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:121)
at sbt.MainLoop$$anonfun$next$1$$anonfun$apply$1.apply(Main.scala:121)
at sbt.State$$anon$1.process(State.scala:154)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:121)
at sbt.MainLoop$$anonfun$next$1.apply(Main.scala:121)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.MainLoop$.next(Main.scala:121)
at sbt.MainLoop$.run(Main.scala:114)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(Main.scala:103)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(Main.scala:100)
at sbt.Using.apply(Using.scala:25)
at sbt.MainLoop$.runWithNewLog(Main.scala:100)
at sbt.MainLoop$.runAndClearLast(Main.scala:83)
at sbt.MainLoop$.runLoggedLoop(Main.scala:67)
at sbt.MainLoop$.runLogged(Main.scala:60)
Error during sbt execution: java.lang.OutOfMemoryError: PermGen space
Please help.
Your project needs more memory to be executed (that's what the java.lang.OutOfMemoryError: PermGen space tells you). I have never used the typesafe stack, thus I don't know if it is possible to configure memory parameters directly.
But if you run Linux you can type
env JAVA_OPTS="-Xms512m -Xmx1024m -Xss1M -XX:MaxPermSize=512" <command>
where command is the command to execute your project (probably it is sbt). Of course, you can change the size of the parameters if you need more/less space.