getting an error when I startup clojure-lsp (looks like a graalvm error, reflection stuff)
Jun 23, 2021 1:38:49 PM org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Unable to invoke no-args constructor for class org.eclipse.lsp4j.CodeLensWorkspaceCapabilities. Registering an InstanceCreator with Gson for this type may fix this problem.
java.lang.RuntimeException: Unable to invoke no-args constructor for class org.eclipse.lsp4j.CodeLensWorkspaceCapabilities. Registering an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:228)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:212)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:131)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:222)
at com.google.gson.Gson.fromJson(Gson.java:932)
at org.eclipse.lsp4j.adapters.InitializeParamsTypeAdapter.readCapabilities(InitializeParamsTypeAdapter.java:151)
at org.eclipse.lsp4j.adapters.InitializeParamsTypeAdapter.read(InitializeParamsTypeAdapter.java:109)
at org.eclipse.lsp4j.adapters.InitializeParamsTypeAdapter.read(InitializeParamsTypeAdapter.java:34)
at com.google.gson.TypeAdapter$1.read(TypeAdapter.java:199)
at com.google.gson.Gson.fromJson(Gson.java:932)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.fromJson(MessageTypeAdapter.java:329)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.parseParams(MessageTypeAdapter.java:249)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.read(MessageTypeAdapter.java:119)
at org.eclipse.lsp4j.jsonrpc.json.adapters.MessageTypeAdapter.read(MessageTypeAdapter.java:55)
at com.google.gson.Gson.fromJson(Gson.java:932)
at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:119)
at org.eclipse.lsp4j.jsonrpc.json.MessageJsonHandler.parseMessage(MessageJsonHandler.java:114)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:193)
at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)
at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)
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)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:553)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Method.java:566)
at com.google.gson.internal.UnsafeAllocator$1.newInstance(UnsafeAllocator.java:50)
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:225)
... 28 more
Caused by: java.lang.IllegalArgumentException: Class org.eclipse.lsp4j.CodeLensWorkspaceCapabilities is instantiated reflectively but was never registered. Register the class by using org.graalvm.nativeimage.hosted.RuntimeReflection
at com.oracle.svm.core.graal.snippets.SubstrateAllocationSnippets.hubErrorStub(SubstrateAllocationSnippets.java:261)
at sun.misc.Unsafe.allocateInstance(Unsafe.java:840)
... 31 more
That's on the debug of CocCommand workspace.showOutput
β― clojure-lsp --version
clojure-lsp 2021.06.21-14.30.54
clj-kondo 2021.06.18
Shall I log an issue on github?
(clojure-lsp fails to startup)
Still getting an error, is quite similar to the one dharrigan posted, but is for a different class:
org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer fireError
SEVERE: Unable to invoke no-args constructor for class org.eclipse.lsp4j.LinkedEditingRangeCapabilities. Registering an InstanceCreator with Gson for this type may fix this problem.
java.lang.RuntimeException: Unable to invoke no-args constructor for class org.eclipse.lsp4j.LinkedEditingRangeCapabilities. Registering an InstanceCreator with Gson for this type may fix this problem.
at com.google.gson.internal.ConstructorConstructor$14.construct(ConstructorConstructor.java:228)
My versions:
clojure-lsp 2021.06.24-01.20.01
clj-kondo 2021.06.18
I pushed up a fix for this error
it's on a PR
<https://github.com/clojure-lsp/clojure-lsp/pull/452>
Waiting for it to be reviewed and merged (if appropriate)
In the meantime, you can apply the branch yourself and build locally?
After that it works grand for me
Yeah I will make the setup in my machine, you use arch linux right, do I need https://aur.archlinux.org/packages/native-image-jdk11-bin/ and there is any other deps?
Nope, although I downloaded graalvm directly and put it on my $PATH
You'll need to build the classes first, i.e., clj -X:javac
then ./graalvm/native-unix-compile.sh
then I put the clojure-lsp
binary in my $PATH to replace the system installed one.
it only builds with java 8 btw
sudo archlinux-java set java-8-openjdk
temporarily
(I'm on 16)
woah haha, I did the make prod-bin
with java-11-openjdk
I'm running make prod-native
now
For me, it falls over unless I build with java 8 π
It compiled fine, but I'm quite dumb and I compiled the master branch of your fork :kill-me:
compiling bugfix/issue-451
now
Yeap can confirm @dharrigan's branch is working fine for me
π
w00t w00t
:partywombat:
My bad, I missed that one :(
Released the fix!
And Arch has been updated to include said fix π
:thanks3:
Is there a way to get source-paths
in clojure-lsp
? whether it has been defined in .lsp/config
or anywhere else(if thatβs possible?) ?
Yes, please, I'll take a look
if your project is not a deps.edn, it'll show on the server-info command
I need to make it show on server-info for deps.edn projects as well
Are you using emacs?
If so, lsp-clojure-server-info should return that
Itβs Calva π And something needed in Calva itself.
You can get the server-info via Calva as well, I know there is a command
Calva server info or something
Yeah, but it prints it to the clojure-lsp output channel. Weβve talked about this before. π (And I still havenβt checked it up closer, hoping that @brandon.ringe will just tell me where to look, haha.)
But isn't that enough? I can see all the necessary info from the output:
np
I didn't catch that because it seems lsp-mode (emacs) doesn't send that for some reason
github issue created π
thanks, I found the problem on both lsp-mode and clojure-lsp, I'll fix both π
Itβs Calva that needs the info. Not the user.
Oh, got it, it's the same issue we talked indeed, I thought @pratikgandhi1997 was with issues on Calva, but it's seems a developer issue π
Yeah, I think there is no easy way ATM, but I thing I can make that work as a custom command
like server-info-raw
or something
That would be awesome.
Thank you π
@pratikgandhi1997 check https://github.com/clojure-lsp/clojure-lsp/issues/450