Closed kakazxl closed 4 years ago
Thanks for reporting! What build tool are you using? There seem to be some issues when running Mill currently.
Also is the Bloop server already running in the background or it cannot even start?
You could try starting Bloop via coursier to see if we can even properly start:
coursier launch ch.epfl.scala:bloopgun-core_2.12:1.4.0-RC1-229-b7c15aa9 -- about
Sorry for late reply, I am using sbt. When I use "sbt -Dbloop.export-jar-classifiers=sources bloopInstall" command, seems somethings wrong with couriser. The log shows below:
[info] Loading settings for project hello from build.sbt ... [info] Set current project to hello (in build file:/D:/workspace/hello/) [success] Total time: 0 s, completed 2020-5-7 13:49:31 [error] java.lang.NoSuchMethodError: lmcoursier.definitions.ToCoursier$.project(Llmcoursier/definitions/Project;)Lcoursier/core/Project; [error] at coursier.sbtcoursier.ResolutionTasks$.$anonfun$resolutionsTask$3(ResolutionTasks.scala:43) [error] at scala.Function1.$anonfun$compose$1(Function1.scala:49) [error] at sbt.internal.util.$tilde$greater.$anonfun$$u2219$1(TypeFunctions.scala:62) [error] at sbt.std.Transform$$anon$4.work(Transform.scala:67) [error] at sbt.Execute.$anonfun$submit$2(Execute.scala:281) [error] at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:19) [error] at sbt.Execute.work(Execute.scala:290) [error] at sbt.Execute.$anonfun$submit$1(Execute.scala:281) [error] at sbt.ConcurrentRestrictions$$anon$4.$anonfun$submitValid$1(ConcurrentRestrictions.scala:178) [error] at sbt.CompletionService$$anon$2.call(CompletionService.scala:37) [error] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [error] at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [error] at java.util.concurrent.FutureTask.run(FutureTask.java:266) [error] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [error] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [error] at java.lang.Thread.run(Thread.java:748) [error] (coursierResolutions) java.lang.NoSuchMethodError: lmcoursier.definitions.ToCoursier$.project(Llmcoursier/definitions/Project;)Lcoursier/core/Project; [error] Total time: 0 s, completed 2020-5-7 13:49:31
@z00420691 Without being able to run bloopInstall
nothing will work properly unfortunately. Maybe you could try changing/updating the sbt version? Or you could try asking on sbt's gitter.
Hello guys. I'm facing a similar issue with plain sbt tested in 3 different cases: ubuntu and ibmjava Docker containers (using Theia instead of vscode) and also in a fresh vscode install in a Mac, so I believe it is safe to say that the latest release does not work out of the box and the issue is not mill related.
Even if tinkering around with settings would work (I have tested JAVA_HOME settings and rolling back metals versions based on other reported issues but without success) I believe at least a simple hello world should run without hassle, otherwise, people will simply give up on the plugin.
I have tried collaborating my two cents to the community by creating a Dockerfile that would bundle Theia+Metals+JVM and other dependencies (including for scala-native, confirmed to work by calling sbt in the terminal in a pet project of mine).
Being docker, I believe it is a nice environment that someone from Metals could pick up and check what is happening (so we avoid the "works on my machine" situation).
For me, after trying multiple mentioned workarounds, I still have the following output on vscode trying to open the hello world cloned from https://github.com/sbt/helloworld-one:
INFO time: initialize in 0.33s
INFO running installed 'bloop bsp --protocol local --socket /var/folders/14/cr2tvlqj4492gfk52fm911180000gp/T/bsp4904052610055866142/-127ng4h66j18s.socket'
ERROR [0m[31m[E][0m Failed to load project from /Users/odantas/git/helloworld-one/.bloop/root.json
WARN no build target: /Users/odantas/git/helloworld-one/src/main/scala/example/Hello.scala
WARN BSP retry 1 due to: no response: bloop bsp
scala.meta.internal.metals.BloopServers$NoResponse$: no response: bloop bsp
at scala.meta.internal.metals.BloopServers.NoResponse$lzycompute$1(BloopServers.scala:283)
at scala.meta.internal.metals.BloopServers.NoResponse(BloopServers.scala:283)
at scala.meta.internal.metals.BloopServers.$anonfun$callBloopMain$1(BloopServers.scala:182)
at scala.util.Success.$anonfun$map$1(Try.scala:255)
at scala.util.Success.map(Try.scala:213)
at scala.concurrent.Future.$anonfun$map$1(Future.scala:292)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:33)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:33)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor
If anyone cannot reproduce it locally and want to try the docker image, this is where I'm working on it: https://github.com/oswaldo/theia-apps/tree/theia-scala-docker/theia-scala-docker
@oswaldo That is a pretty old project with a Scala version that is not supported in Metals, I would recomend something like from the template here https://github.com/scala/hello-world.g8/tree/master/src/main/g8 - can be generated also via sbt new
command.
I've also played around with Gitpod and eclipse Theia, which should be working here: https://github.com/tgodzik/metals-sample
If you still have some problems please attach the full log, so we can take a look there.
Thanks for the fast reply. I found out that my container was actually working. I tried another restart metals one last time and all was fine afterwards (even with the old hello world which I had adjusted sbt and scala versions, so it was according to the minimum requirements) I'll try the other project you mentioned and probably mention it in my readme when I get some spare time for it. Thanks again and good luck with this awesome project ππΌ Hopefully all is well for the creator of this issue too.
Hi, I found that my problem is related with custom sbt for I use my own sbt to replace the embedded launcher because of respository. The vscode output shows that running sbt bloopinstall fails and here is the log:
#############log############## 2020.05.20 11:05:47 INFO running 'D:/sbt/bin/sbt -Dbloop.export-jar-classifiers=sources bloopInstall' 2020.05.20 11:05:47 INFO build tool exit: -2147483648 2020.05.20 11:05:47 INFO time: ran 'sbt bloopInstall' in 0.25s 2020.05.20 11:05:47 ERROR sbt command failed: D:/sbt/bin/sbt -Dbloop.export-jar-classifiers=sources bloopInstall 2020.05.20 11:05:51 INFO tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at C:\Users\xxxxxxx\AppData\Local\scalameta\metals\cache\bsp.trace.json 2020.05.20 11:05:56 ERROR Timeout waiting for 'build/initialize' response 2020.05.20 11:05:56 ERROR Failed to connect with build server, no functionality will work. ############log##############
The custom sbt runs successfully in cmd, and bloop json has also generated. I wonder custom sbt setting wrong in vscode? Thanks for your reply.
Update: I used embedded sbt with .jvmopts and it imports build and connects to bsp server successfully. I am facing compiling problem right now. The log shows: ERROR Unexpected error when compiling root: 'Couldn't retrieve module ch.epfl.scala:compiler-bridge_2.12:1.3.0-M4+42-5daa8ed7:compile' I think it is another proxy problem but I find this jar in ivy2 dir, can I copy this jar to a specified dir to handle this problem and whre is the dir? Thanks.
@z00420691 That might be coming from Bloop. You should mos likely set the proxy settings there as well: https://scalameta.org/metals/docs/build-tools/proxy.html#proxy-settings Or alternatively coursier mirrors should work for both Metals and Bloop.
@z00420691 Did you manage to solve the issue? Most likely you need the .jvmopts
also for Bloop in ~/.bloop
- not 100% sure how the path should look like on window.
Bloop version is now at 1.4.3, let's reopen the issue if you encounter any problems with the current Metals version.
enconuter the same error:
Java home: /usr/lib/jvm/java-8-openjdk-amd64
Metals version: 0.10.7
2021.10.05 18:28:02 INFO logging to file /home/peng/git/shapesafe/.metals/metals.log
2021.10.05 18:28:02 INFO Started: Metals version 0.10.7 in workspace '/home/peng/git/shapesafe' for client Visual Studio Code - Insiders 1.61.0-insider.
2021.10.05 18:28:02 INFO time: initialize in 0.4s
Initializing Scala Debugger
2021.10.05 18:28:02 INFO Flyway Community Edition 7.14.1 by Redgate
2021.10.05 18:28:02 INFO Database: jdbc:h2:file:/home/peng/git/shapesafe/.metals/metals (H2 1.4)
2021.10.05 18:28:02 INFO Successfully validated 3 migrations (execution time 00:00.019s)
2021.10.05 18:28:02 INFO Current version of schema "PUBLIC": 3
2021.10.05 18:28:02 INFO Schema "PUBLIC" is up to date. No migration necessary.
2021.10.05 18:28:02 INFO Attempting to connect to the build server...
2021.10.05 18:28:02 WARN no build target for: /home/peng/git/shapesafe/core/src/test/scala/org/shapesafe/core/CommutativeRingProofSpike.scala
2021.10.05 18:28:03 ERROR Failed to connect with build server, no functionality will work.
java.lang.RuntimeException: The server did not start, got FailedToOpenBspConnection
at bloop.launcher.LauncherMain.failPromise$1(Launcher.scala:95)
at bloop.launcher.LauncherMain.runLauncher(Launcher.scala:122)
at scala.meta.internal.metals.BloopServers$$anon$1.run(BloopServers.scala:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
The more severe problem is that the real error was hidden. Making it impossible to address it properly
I need to try and figure out why it's masking the real issues. In the meantime, could you check if a Bloop process is running in the background (it could be a leftover broken process, though I have never been able to reproduce it). You could do ps aux | grep bloop
and maybe then kill -9 <pid>
? Alternatively, could you try and install bloop commandline and see if it's running from there? https://scalacenter.github.io/bloop/setup
I too have the same error on Windows. I can't start the bloop server from the command line either. This was working fine just a few days ago and for months before that. I see .bloop.aux.exe start and then everything shuts down.
No server running at 127.0.0.1:8212, let's fire one...
Resolving ch.epfl.scala:bloop-frontend_2.12:1.4.10...
Starting bloop server at 127.0.0.1:8212...
Attempting a connection to the server...
error: Command 'java -Xss4m -XX:MaxInlineLevel=20
This is the same error I see in the metals log.
@rtosman Are you able to run the previous version of Bloop? I don't think we changed anything around starting tha java process :thinking:
No, I cannot run the previous version any longer. I did upgrade but only after it stopped working in an attempt to fix it. I have tried running "bloop start" from the command line and it behaves the same way. Asking here, as it seems to be something that people run into with metals. I have no clue why a local server shouldn't be able to start.
eventually this FailedToOpenBspConnection
error has its roots in an defect Java JDK installation, and a wrong Java Home. See also:
The server did not start, got FailedToOpenBspConnection and Issue 1719
"This might mean that you don't have your java installation on your PATH and Bloop was unable to start"
please console check which java
and java --version
also.
β― which java
CommandType Name Version Source
----------- ---- ------- ------
Application java.exe 8.0.2610.β¦ C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe
IS there nothing after error: Command 'java -Xss4m -XX:MaxInlineLevel=20
? Does it get truncated?
I also have problems with this inside the vscode devcontainer:
Java home: /nix/store/lvmz1yy4v20f0c7rg55bhfxwiaqfi2rj-openjdk-11.0.12+7
Metals version: 0.10.8
2021.10.30 15:06:43 INFO logging to file /src/analytics/.metals/metals.log
2021.10.30 15:06:43 INFO Started: Metals version 0.10.8 in workspace '/src/analytics' for client Visual Studio Code 1.61.2.
2021.10.30 15:06:45 INFO time: initialize in 1.85s
Initializing Scala Debugger
2021.10.30 15:06:46 INFO Flyway Community Edition 8.0.1 by Redgate
2021.10.30 15:06:46 INFO Database: jdbc:h2:file:/src/analytics/.metals/metals (H2 1.4)
2021.10.30 15:06:46 INFO Successfully validated 3 migrations (execution time 00:00.025s)
2021.10.30 15:06:46 INFO Current version of schema "PUBLIC": 3
2021.10.30 15:06:46 INFO Schema "PUBLIC" is up to date. No migration necessary.
2021.10.30 15:06:46 INFO Attempting to connect to the build server...
2021.10.30 15:06:46 INFO skipping build import with status 'Installed'
2021.10.30 15:06:47 ERROR Failed to connect with build server, no functionality will work.
java.lang.RuntimeException: The server did not start, got FailedToOpenBspConnection
at bloop.launcher.LauncherMain.failPromise$1(Launcher.scala:95)
at bloop.launcher.LauncherMain.runLauncher(Launcher.scala:122)
at scala.meta.internal.metals.BloopServers$$anon$1.run(BloopServers.scala:159)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
at java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.lang.Thread.run(Thread.java:829)
I find it strange that everything else works besides bloop (sbt etc.). It would be incredibly useful if bloop where able to give some kind of logging or error message somewhere to pick up. Using --verbose for bloop doesn't is completely silent.
I am new to metals and I am facing a problem that bsp server starts failed. I have set JAVA_HOME env and specify the java path in metals.java_home settings in vscode. I wonder is there any setting wrong with metals. Thanks for your reply. Btw, the log shows "bsp --port 19921", but error info shows "no server running at 8212", does the port need to be specified?
-Logs: Starting the bsp launcher for bloop... Opening a bsp server connection with 'bsp --protocol tcp --port 19921'... Waiting for the bsp connection to come up... WARN no build target for: D:\workspace\hello\src\main\scala\test.scala Waiting for the bsp connection to come up... Waiting for the bsp connection to come up... error: Giving up on waiting for a connection, printing embedded bloop logs: