Error Running Play2 Application: "head of empty stream"

Occasionally I get this error when trying to Run a Play2 application using the default "Play 2 App" configuration.  I cannot run the Play application within the IDE due to this, and would like an answer as to what is wrong, and how this issue can be fixed.  I have this issue  with IJ 14 or 15.  Code has compiled and everything appears to be 'normal' otherwise.

Does anyone else experience this problem?

"C:\Program Files\Java\jdk1.8.0_66\bin\java" -Dfile.encoding=UTF8 -Djline.terminal=none -Dsbt.log.noformat=true -Dsbt.global.base=C:\Users\david.hildebrandt\AppData\Local\Temp\sbt-global-plugin39stub -Xms512M -Xmx1024M -Xss1M -XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M -classpath "C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\lib\idea_rt.jar;C:\Program Files (x86)\JetBrains\IntelliJ IDEA 15.0.2\lib\util.jar" com.intellij.rt.execution.CommandLineWrapper C:\Users\xxxx.xxxx\AppData\Local\Temp\classpath0.tmp xsbt.boot.Boot "project root" ~run
Error during sbt execution: java.util.NoSuchElementException: head of empty stream
java.util.NoSuchElementException: head of empty stream
 at scala.collection.immutable.Stream$Empty$.head(Stream.scala:1026)
 at xsbt.boot.BootFilteredLoader.<init>(FilteredLoader.scala:29)
 at xsbt.boot.Launch.<init>(Launch.scala:149)
 at xsbt.boot.Launcher$.apply(Launch.scala:366)
 at xsbt.boot.Launch$.apply(Launch.scala:18)
 at xsbt.boot.Boot$.runImpl(Boot.scala:41)
 at xsbt.boot.Boot$.main(Boot.scala:17)
 at xsbt.boot.Boot.main(Boot.scala)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:497)
 at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:46)
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0

Process finished with exit code 1

11 comments
Comment actions Permalink

David you're a champ! It worked!

I decided to spend some time to compare the configuration between projects, and after some trial and error I found the culprit. Removing the "dynamic.classpath" property below from the workspace.xml (or setting it to false) fixed the problem.

<component name="PropertiesComponent">
...
<property name="dynamic.classpath" value="true" />
</component>

If it happens again should be quicker than loading project from scratch :)

8
Comment actions Permalink

Hello,

could you tell me, does the project run fine with sbt console?

0
Comment actions Permalink

I have exactly the same issue, the project runs fine with sbt console. 

0
Comment actions Permalink

I'm running into this exact issue today.  Yesterday everything was fine... today trying to start any SBT Task configuration results in:

Error during sbt execution: java.util.NoSuchElementException: head of empty stream
java.util.NoSuchElementException: head of empty stream
at scala.collection.immutable.Stream$Empty$.head(Stream.scala:1026)
at xsbt.boot.BootFilteredLoader.<init>(FilteredLoader.scala:29)
at xsbt.boot.Launch.<init>(Launch.scala:149)
at xsbt.boot.Launcher$.apply(Launch.scala:364)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:49)
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; support was removed in 8.0
Picked up _JAVA_OPTIONS: -Xmx2g

 

I've tried the following:

- Upgraded to latest 2016.2 version

- Upgraded local SBT install

- Cleared cache, restarted, rebooted machine, created new configs

 

Anyone have an idea?  Strange that it had been working perfectly for months and without any changes now refuses to launch.  This "fails fast"... it's almost the moment you start the config in play/debug

 

0
Comment actions Permalink

Hello, 

could you please specify: what scala plugin, sbt, play framework and project jdk version do you use? Also is your project open sourced?

0
Comment actions Permalink

Experiencing the same problem. Can't do anything to fix. Project work has halted because of this. Please help!

Intellij 2016.2.4


Plugins ----->
Scala 2016.2.1
sbt 2016.2.1
Playframework support v1.0

Project -------->
Play 2.5.4
Scala 2.11.7

0
Comment actions Permalink

Anybody found fix/workaround?

0
Comment actions Permalink

Hi Peter:  

If I recall correctly, I would do something like the following:

a) close IntelliJ

b) move my project from <project-name> to <project-name-old>

c) clone project <project-name> from the remote repository to my local file system

d) start IntelliJ

e) open <project-name>

f) build and run the Play the application - tap fingers for many, many minutes while Scala compilation completes

g) get back to work

I looked a little into other possible solutions, but this one worked every time.  Heavy handed, but effective.

Good luck!

0
Comment actions Permalink

Hi Peter.  Thanks for determining the real problem.  That is indeed the right kind of solution and I am sure it will serve everyone well who encounters this problem.  It might also provide insight to the IntelliJ team to keep it from happening at all.  That's good work.

 

0
Comment actions Permalink

Removing the "dynamic.classpath" helps! Thanks a lot

0
Comment actions Permalink

I have exactly same problem. I was not doing anything with project and opened it after 3 months, now I am unable to start it and mentoined fix did not help... I do not even have set:

<property name="dynamic.classpath" value="true" />

and when I manually set it to false I still keep having same error...

Yeah spending more time fixing my workspace then actually programming changes to project...

0

Please sign in to leave a comment.