sbt server fails to start throwing error 231 - scala

When I am trying to start sbt, it fails throwing an IO exception.
Version of SBT - 1.1.2
Version of Scala - 2.12.6
Error:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\username\IdeaProjects\projectname\project
[info] Loading settings from build.sbt ...
[info] Set current project to example (in build file:/C:/Users/username/IdeaProjects/projectname/)
[error] server failed to start on local:sbt-server-ad238fc8ee352b69065c. java.io.IOException: Could not create lock for
\\.\pipe\sbt-server-ad238fc8ee352b69065c_lock, error 231

Analysing the source of the throw it seems error code 231 refers to Windows error:
ERROR_PIPE_BUSY
231 (0xE7)
All pipe instances are busy.
The pipe cannot be accessed because another process is using it, so try closing down IntelliJ and any other SBT server running, and try again later. Perhaps even reboot the machine, and then start a single system SBT server (not IntelliJ), and see if the issue persists.

Related

Library cannot be resolved

When I package Scala project using SBT, I face the following problem:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from D:\marathon-master\project
Version '20170916T025229' is not fully supported, please update the git tags.
[info] Set current project to marathon (in build file:/D:/marathon-master/)
[info] Constructing RAML model
java.lang.RuntimeException: Library cannot be resolved: D:\marathon-master\docs\docs\rest-api\public\api\appContainer.raml -- D:\marathon-master\docs\docs\rest-api\public\api\v2/types/app.raml [line=6, col=17]
at scala.sys.package$.error(package.scala:27)
...
[error] (marathon/compile:ramlGenerate) Library cannot be resolved: D:\marathon-master\docs\docs\rest-api\public\api\appContainer.raml -- D:\marathon-master\docs\docs\rest-api\public\api\v2/types/app.raml [line=6, col=17]
And the 5-7 lines code in app.raml like that:
uses:
appContainer: appContainer.raml
artifact: artifact.raml
the directory of app.raml and appContainer.raml is "D:\marathon-master\docs\docs\rest-api\public\api\v2/types/" both. So I change 6 line of app.raml like that:
appContainer: v2/types/appContainer.raml
But when I run "sbt package" again, a warning shows up:
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m;
support was removed in 8.0
[info] Loading project definition from D:\marathon-master\project
Version '20170916T025721' is not fully supported, please update the git tags.
[info] Set current project to marathon (in build file:/D:/marathon-master/)
[warn] File D:\marathon-master\docs\docs\rest-api\public\api\v2\types\v2\types\appContainer.raml does not exist (referenced by
D:\marathon-master\docs\docs\rest-api\public\api\v2\types\app.raml)
[info] Constructing RAML model
java.lang.RuntimeException: Library cannot be resolved: D:\marathon-master\docs\docs\rest-api\public\api\artifact.raml -- D:\marathon-master\docs\docs\rest-api\public\api\v2/types/app.raml [line=7, col=13]
...
[error] (marathon/compile:ramlGenerate) Library cannot be resolved:
D:\marathon-master\docs\docs\rest-api\public\api\artifact.raml -- D:\marathon-master\docs\docs\rest-api\public\api\v2/types/app.raml [line=7, col=13]
why have this warning? Any idea?

Can't build kie-wb-webapp 6.1.x (JBPM)

I need to modify KIE Workbench source and I have two issues that are stopping me from building with Maven 3.2.5, one on Windows and one on Linux.
On Windows 7, I am getting an error that says
[deletia...]SNAPSHOT\uberfire-backend-api-0.4.0-SNAPSHOT-sources.jar,
com.google.gwt.dev.Compiler,-logLevel, INFO, -style, OBF, -war,
c:\kie-wb-webapp\target\kie-wb-webapp-6.1.1-SNAPSHOT, -localWorkers, 1,
-strict, -XfragmentCount, -1, -deploy, c:\kie-wb-webapp\target\gwt-symbols-deploy, -gen,
c:\kie-wb-webapp\target\.generated, org.kie.workbench.FastCompiledKIEWebapp]:
Error while executing process. Cannot run program "c:\development\software\jdk\jdk1.7.0_71\jre\bin\java":
CreateProcess error=206, The filename or extension is too long.
So I looked it up and apparently, this is well known limitation since gwt-maven-plugin creates a command-line that is longer than 8191 chars and this is forbidden. So I gave it a shot on Ubuntu.
On Ubuntu,
I am getting:
[INFO] --- gwt-maven-plugin:2.5.1:compile (gwt-compile) # kie-wb-webapp [ERROR] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[ERROR] Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
[INFO] Compiling module org.kie.workbench.FastCompiledKIEWebapp
[INFO] Validating units:
[INFO] [ERROR] Errors in 'jar:file:/home/rich/.m2/repository/com/google/guava/guava-gwt/14.0.1/guava-gwt-14.0.1.jar!/com/google/common/primitives/Booleans.java'
[INFO] [ERROR] Line 29: The import java.util.BitSet cannot be resolved
[INFO] [ERROR] Aborting compile due to errors in some input files
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE*
It's really important that I find a workaround to 1 or both of these issues (my guess is that if I clear the command-line issue on Windows, I'll just run into the guava issue again). Also, unless it's absolutely necessary, I can't upgrade to 6.2.x, because this would cause a lot of work for my project.
Has anyone run into this?
If you don't need Java 8 support, you may be able to solve the problem by using an earlier version of the JDK. I believe that you do this by setting JAVA_HOME for your Maven run. You can download a JDK 7 here.
You could also build Guava yourself from HEAD, as the problem has been fixed there but not included in a release. Or you could wait for a 19.0-rc1, which we hope to have out soon.

Trying to install SBT-0.13.8 for Windows 7 installs SBT version 0.12.4

I have (multiple times) tried to install SBT-0.13.8 from the SBT download page via the SBT-0.13.8-MSI button and I always end up getting an SBT version which shows the following output
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\Tina\Desktop\example\project\project
error: error while loading CharSequence, class file 'C:\Program Files\Java\jre1.
8.0_20\lib\rt.jar(java/lang/CharSequence.class)' is broken (bad constant pool tag 15 at byte 1470)
[error] Type error in expression
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? i
[warn] Ignoring load failure: no project loaded.
> about
[info] This is sbt 0.12.4
[info] No project is currently loaded
[info] sbt, sbt plugins, and build definitions are using Scala 2.9.2
SBT produces an error message and (!) shows itself as version 0.12.4.!!!
I really made sure that I have no other version of SBT installed and I even made a reboot before re-installing it but nothing changed. SBT files have a creation date of March, 21, 2015. This seems to be the newest version but why does this version show up as 0.12.4 and does not work with JDK1.8?
Looks like the directory you're in is wrong, you want to launch sbt from C:\Users\Tina\Desktop\example\project not C:\Users\Tina\Desktop\example\project\project (note 1 project less).
The second problem you're having is you're trying to use sbt 0.12.4 with Java 8. sbt 0.12.4 uses (as can be seen from the output) Scala 2.9.2 which doesn't work with Java 8. I would recommend migrating to sbt 0.13.8, but if not you could always downgrade to Java 7.
Edit after comments below
The progfun Coursera course download is still configured with sbt
0.12.4 which you're having trouble building because you are using Java 8.
I had a quick go at trying to see if upgrading the project to 0.13.8 would work (FYI it involves editing project/build.properties), but then plugins need to be upgraded, then meta-build code needed to be changed because of namespace changes..
Unless you're willing to experiment more and work you're way through the various changes required to use latest sbt and latest Java (which is what I would do if this were for myself), I would recommend as an alternative to:
Downgrade to Java 7
Notify the relevant people involved in running the course that the source material should be updated as it demonstrably does not work on latest, stable Java.
If your default Java is Java 8 but you want to switch to Java 7 for this out-of-date project setup, you need to create an .sbtopts file at the root of the project containing (note: on separate lines!):
-java-home
C:\Users\Tina\PATH\TO\YOUR\JAVA\HOME

Deploying Play Framework 2.3.x (Java style) on Ubuntu 14.04 production server

I have a Play application on my laptop, which I am trying to get running on my production server. Locally the application compiles and works without errors.
On my production server, I do the following:
root#example:~/mysite# ./activator
[info] Loading project definition from home/mysite/project
[info] Set current project to mysite (in build file:/home/mysite/)
[mysite] $ ~run
--- (Running the application, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 4 Scala sources and 2 Java sources to /home/mysite/target/scala-2.11/classes...
[info] 'compiler-interface' not yet compiled for Scala 2.11.1. Compiling...
Killed
root#example:~/mysite#
As you can see, `compiler-interface' is not yet compiled. I am wondering why this is. Is this because I don't have the Scala compiler installed?
Probably the Killed part is because you don't have enough memory to compile your application.
Either way I think it would be better to deploy your app already compiled than compile it on place. You can do that using ./activator dist.
This will generate a zip file in YOUR_PROJECT_DIR/target/universal named YOUR-PROJECT-NAME-VERSION.zip with everything already compiled and with every needed dependency packaged already. You can then upload this file to somewhere in your production server, extract it and then start the server using
$ EXTRACTED_FOLDER/bin/YOUR-APP-NAME
If you still want to build it in your production server, try to reduce the memory used by activator using
$ ./activator -mem 200 # MAX 200mb
// (...)
[PROJECT-NAME] ~start
Note that ~run will start your server in dev mode (ie sensible information like stacktraces etc can be shown on error) and recompile it on changes, so you may want to use start or ~start instead.

Play2 run via Sbt in dev mode on Osx Causes Out of Memory

I can't seem to find similar issues.
On OSX, play2 bin seems to run okay but using sbt causes oom errors and scala files never complete compiling
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on port 9000...
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 15 Scala sources and 2 Java sources to
/Users/tripled153/Development/src/Foundation/playApp/target/scala-2.9.1/classes...
Java HotSpot(TM) 64-Bit Server VM warning: Exception
java.lang.OutOfMemoryError occurred dispatching signal Unknown Signal
to handler- the VM may need to be forcibly terminated
I'm running with extended memory settings but still no luck. Running in staged (prod) mode appears okay though.
rundev.sh
export SBT_OPTS="-Xms512M -Xmx3536M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC -XX:MaxPermSize=512M"
sudo sbt clean run