使用nailgun时Scala编译服务器错误

时间:2013-09-18 12:17:33

标签: java scala intellij-idea nailgun

我目前正在使用IntelliJ Idea 13.0 Build 132.197,我在构建任何Scala项目时经常遇到此问题

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)

当我只打开一个项目而没有在任何其他进程中使用nailgun时,会发生此错误。关闭并重新打开项目不起作用。退出IntelliJ并重新启动后,我仍然遇到相同的错误。

在Windows任务管理器中,我看到java.exe进程,其中包含以下详细信息:

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

这是因为Nailgun设置存在问题吗?

1 个答案:

答案 0 :(得分:47)

以下是这种情况的手动解决方案:

  • 在端口3200上找到进程(PID)侦听(在设置中检查> scala> tcp端口)
    • 在Mac(Linux)上:lsof -i :3200
  • 检查该过程
    • 在Mac(Linux)上:ps axu |grep <PID>
    • 就我而言,它以org.jetbrains.plugins.scala.nailgun.NailgunRunner 3200
    • 结尾
  • 杀死进程,它是一个旧的,IDEA将启动新的进程
    • 在Mac(Linux)上:kill -9 <PID>