Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scala compile server error when using nailgun

Tags:

I am currently using IntelliJ Idea 13.0 Build 132.197, and I frequently run into this problem when building any Scala projects

6:08:42 PM Scala compile server: java.net.BindException: Address already in use: JVM_Bind     at java.net.DualStackPlainSocketImpl.bind0(Native Method)     at java.net.DualStackPlainSocketImpl.socketBind(DualStackPlainSocketImpl.java:106)     at java.net.AbstractPlainSocketImpl.bind(AbstractPlainSocketImpl.java:376)     at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:190)     at java.net.ServerSocket.bind(ServerSocket.java:376)     at java.net.ServerSocket.(ServerSocket.java:237)     at com.martiansoftware.nailgun.NGServer.run(Unknown Source)     at java.lang.Thread.run(Thread.java:724) 

This error happens when I have only 1 project open, and without using nailgun in any other processes. Closing and re-opening the project does not work. I still get the same error after Exiting from IntelliJ and re-starting it.

In Windows Task Manager, I see a java.exe process with the following details:

E:\Dev\Java\bin\java -cp "E:/Dev/Java/lib/tools.jar;C:/Program Files (x86)/JetBrains/IntelliJ IDEA 132.197/lib/jps-server.jar;C:/Program Files (x86)/JetBrains/IntelliJ IDEA 132.197/lib/trove4j.jar;C:/Program Files (x86)/JetBrains/IntelliJ IDEA 132.197/lib/util.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/scala-library.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/scala-plugin-runners.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/jps/nailgun.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/jps/sbt-interface.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/jps/incremental-compiler.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/jps/jline.jar;C:/Users/hanxue/.IntelliJIdea13/config/plugins/Scala/lib/jps/scala-jps-plugin.jar" -Xmx1024m -server -Xss1m -XX:MaxPermSize=256m org.jetbrains.plugins.scala.nailgun.NailgunRunner 3200 

Is this because of an issue with Nailgun settings?

like image 308
Hanxue Avatar asked Sep 18 '13 12:09

Hanxue


1 Answers

Here is a manual solution of a such situation:

  • find the process (PID) listening on port 3200 (check it in settings>scala>tcp port)
    • on Mac(Linux): lsof -i :3200
  • check that process
    • on Mac(Linux): ps axu |grep <PID>
    • in my case it ended with org.jetbrains.plugins.scala.nailgun.NailgunRunner 3200
  • kill the process, it is some old one and IDEA will start the new one
    • on Mac(Linux): kill -9 <PID>
like image 127
chipiik Avatar answered Sep 29 '22 12:09

chipiik