Metals: ClassNotFoundException: scala.meta.internal.fastparse.utils.ParserInput

Created on 5 Dec 2018  路  11Comments  路  Source: scalameta/metals

Using an empty project with only this line:

libraryDependencies += "org.http4s" %% "http4s-blaze-client" % "0.19.0-M2"

using sbt 1.2.6 with scala 2.12.7.

metals buit with coursier bootstrap --java-opt -XX:+UseG1GC --java-opt -XX:+UseStringDeduplication --java-opt -Xss4m --java-opt -Xms1G --java-opt -Xmx4G --java-opt -Dmetals.client=vim-lsc org.scalameta:metals_2.12:0.2.11+6-ad885b32-SNAPSHOT -r bintray:scalacenter/releases -r sonatype:snapshots -o ~/usr/bin/metals-vim -f

importing the build in neovim with vim-lsc shows the trace:

info  running embedded 'bloop bsp --protocol local --socket /tmp/bsp4867092751211714147/bi2tchrmm64d.socket'
info  tracing is disabled for protocol BSP, to enable tracing of incoming and outgoing JSON messages create an empty file at /home/tek/.cache/metals/bsp.trace.json                                                                           
info  time: connected to build server in 2.07s
al.mtags.OnDemandSymbolIndex.$anonfun$addSourceJar$3$adapted(OnDemandSymbolIndex.scala:55)
        at scala.meta.internal.mtags.ListFiles$$anon$1.visitFile(ListFiles.scala:23)
        at scala.meta.internal.mtags.ListFiles$$anon$1.visitFile(ListFiles.scala:18)
        at java.nio.file.Files.walkFileTree(Files.java:2670)
        at java.nio.file.Files.walkFileTree(Files.java:2742)
        at scala.meta.internal.mtags.ListFiles$.foreach(ListFiles.scala:18)
        at scala.meta.internal.mtags.OnDemandSymbolIndex.$anonfun$addSourceJar$2(OnDemandSymbolIndex.scala:55)
        at scala.meta.internal.mtags.OnDemandSymbolIndex.$anonfun$addSourceJar$2$adapted(OnDemandSymbolIndex.scala:54)
        at scala.meta.internal.io.PlatformFileIO$.withJarFileSystem(PlatformFileIO.scala:86)
        at scala.meta.internal.io.FileIO$.withJarFileSystem(FileIO.scala:43)
        at scala.meta.internal.mtags.OnDemandSymbolIndex.$anonfun$addSourceJar$1(OnDemandSymbolIndex.scala:54)
        at scala.meta.internal.mtags.OnDemandSymbolIndex.tryRun(OnDemandSymbolIndex.scala:87)
        at scala.meta.internal.mtags.OnDemandSymbolIndex.addSourceJar(OnDemandSymbolIndex.scala:53)
        at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$installWorkspaceBuildTargets$12(MetalsLanguageServer.scala:788)                                                                                                           
        at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$installWorkspaceBuildTargets$12$adapted(MetalsLanguageServer.scala:780)                                                                                                   
        at scala.collection.immutable.List.foreach(List.scala:388)
        at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$installWorkspaceBuildTargets$10(MetalsLanguageServer.scala:780)                                                                                                           
        at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$installWorkspaceBuildTargets$10$adapted(MetalsLanguageServer.scala:779)                                                                                                   
        at scala.collection.Iterator.foreach(Iterator.scala:937)
        at scala.collection.Iterator.foreach$(Iterator.scala:937)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1425)
        at scala.collection.IterableLike.foreach(IterableLike.scala:70)
        at scala.collection.IterableLike.foreach$(IterableLike.scala:69)
        at scala.collection.AbstractIterable.foreach(Iterable.scala:54)
        at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$installWorkspaceBuildTargets$9(MetalsLanguageServer.scala:779)                                                                                                            
        at scala.meta.internal.metals.MetalsLanguageServer.$anonfun$installWorkspaceBuildTargets$9$adapted(MetalsLanguageServer.scala:774)                                                                                                    
        at scala.util.Success.$anonfun$map$1(Try.scala:251)
        at scala.util.Success.map(Try.scala:209)
        at scala.concurrent.Future.$anonfun$map$1(Future.scala:288)
        at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
        at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
        at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
        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)
Caused by: java.lang.ClassNotFoundException: scala.meta.internal.fastparse.utils.ParserInput
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)

Most helpful comment

I find it nice with the current scheme that users can easily install snapshot releases too after every merge into master, that helps to troubleshoot issues like this one here.

All 11 comments

I am unable to reproduce with the exact same command in the following sbt build

/project/build.properties
sbt.version=1.2.6
/build.sbt
libraryDependencies += "org.http4s" %% "http4s-blaze-client" % "0.19.0-M2"
/src/main/scala/a/Foo.scala
object Foo

Could you maybe publish locally the branch from https://github.com/scalameta/metals/pull/376 and see if the stacktrace is more helpful? The error appears to come from parsing a source file in the library dependencies, it would be good to know what exact file.

I just merged #376 so there should be a new snapshot release soon that you can try out without publishing locally.

fixed by updating coursier!

Great! The installation docs include fetching an up-to-date version of the coursier binary but it should probably be stressed that you really should upgrade to the latest coursier if you have it already installed.

Updated docs to mention the required coursier version https://github.com/scalameta/metals/pull/377

@olafurpg there's still a coursier binary shipped with the vscode extension, so I assumed that's unused? Maybe we could go back to that approach, and bring our own coursier?

Nevermind, I just realized what I said makes no sense. Ignore my last comment :P

@gabro we use the embedded coursier binary in the vscode extension and it's updated to the latest version here https://github.com/scalameta/metals-vscode/pull/8

We could provide pre-generated metals-vim and metals-sublime binaries to avoid this situation but I think that approach would cost more trouble than the benefits we'd gain

@gabro we use the embedded coursier binary in the vscode extension and it's updated to the latest version here scalameta/metals-vscode#8

See https://github.com/scalameta/metals/issues/375#issuecomment-444826532 :D

We could provide pre-generated metals-vim and metals-sublime binaries to avoid this situation but I think that approach would cost more trouble than the benefits we'd gain

I don't know Travis that well, but if one could just have the CI generate them and attach them to releases it would be more convenient than manual building. Not a priority though.

I find it nice with the current scheme that users can easily install snapshot releases too after every merge into master, that helps to troubleshoot issues like this one here.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fommil picture fommil  路  3Comments

ckipp01 picture ckipp01  路  3Comments

vadeg picture vadeg  路  3Comments

laughedelic picture laughedelic  路  4Comments

FereX98 picture FereX98  路  4Comments