我在OpenVZ虚拟化下有一台ubuntu机器。当我运行fsc test.scala时,我得到:
Unable to establish connection to compilation daemon
然后ps aux
向我展示了许多看起来像这样的过程
ren 17482 0.0 0.0 4908 1400 pts/0 S 00:29 0:00 /bin/bash --posix /usr/bin/scala -Djava.net.preferIPv4Stack=true scala.tools
ren 17490 0.2 0.5 1246676 24268 pts/0 Sl 00:29 0:00 java -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv4Stack=true -Xbootc
我已经没有想法如何让它发挥作用,版本为Scala code runner version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL
。有什么想法吗?
修改
找到this,所以:
Fast Scala compiler version 2.9.2 -- Copyright 2002-2011, LAMP/EPFL [Given arguments: -verbose] [Transformed arguments: -verbose -current-dir /home/ren] [VM arguments: ] [Temp directory: /tmp/scala-devel/ren] [Port number: 36737] java.net.SocketException: Invalid argument or cannot assign requested address [Connecting to compilation daemon at port 36737 failed; re-trying...] No compile server running: starting one with args '' [Executing command: scala scala.tools.nsc.CompileServer -v] Starting CompileServer on port 34962 Redirect dir is /tmp/scala-devel/ren/output-redirects [Port number: 34962] java.net.SocketException: Invalid argument or cannot assign requested address [Connecting to compilation daemon at port 34962 failed; re-trying...] [Port number: 34962] java.net.SocketException: Invalid argument or cannot assign requested address [Connecting to compilation daemon at port 34962 failed; re-trying...] No compile server running: starting one with args '' and so on ...
编辑2:
好吧,像这样scala scala.tools.nsc.CompileServer -v
启动编译服务器实际上有效!似乎fsc确实启动了所有这些服务器,但由于某种原因它决定它没有。 fsc -server localhost:port test.scala
有效。现在哪个好了。
答案 0 :(得分:3)
似乎fsc使用hostname
连接到编译服务器。我的主机名没有响应ping。在/etc/hostname
中将其更改为localhost修复了问题。