GroovyLanguageServer / groovy-language-server

A language server for Groovy — designed for Moonshine IDE, but may be useful in other environments
https://moonshine-ide.com/
Apache License 2.0
185 stars 61 forks source link

Server crashing with InvocationTargetException caused by 'URI has an authority component' (or deny to access containers' storage?) #93

Closed Jorenar closed 1 month ago

Jorenar commented 1 month ago

Hi! I'm trying to configure the language server for Groovy in (Neo)Vim, but have some problems. No completion of variables can is triggered, and LSP client's log files are full of errors.

I've tried to gather anything that could be deem useful:



If I remove root_uri line from config, I see somewhat different errors in log files, but the server doesn't work nevertheless.

Java exceptions... ``` Oct 14, 2024 3:33:02 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint fallbackResponseError SEVERE: Internal error: java.lang.reflect.InvocationTargetException java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65) ... 11 more Caused by: java.io.UncheckedIOException: java.nio.file.AccessDeniedException: /home/user/.local/share/containers/storage/overlay/105cf5ff6b6f910a74c1313e5c07f66bec08ef44306c587370f8084fb84ac074/work/work at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:87) at java.base/java.nio.file.FileTreeIterator.hasNext(FileTreeIterator.java:103) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at net.prominic.groovyls.config.CompilationUnitFactory.addDirectoryToCompilationUnit(CompilationUnitFactory.java:164) at net.prominic.groovyls.config.CompilationUnitFactory.create(CompilationUnitFactory.java:98) at net.prominic.groovyls.GroovyServices.createOrUpdateCompilationUnit(GroovyServices.java:413) at net.prominic.groovyls.GroovyServices.setWorkspaceRoot(GroovyServices.java:130) at net.prominic.groovyls.GroovyLanguageServer.initialize(GroovyLanguageServer.java:77) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ... 13 more Caused by: java.nio.file.AccessDeniedException: /home/user/.local/share/containers/storage/overlay/105cf5ff6b6f910a74c1313e5c07f66bec08ef44306c587370f8084fb84ac074/work/work at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) at java.base/sun.nio.fs.UnixException.asIOException(UnixException.java:115) at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:477) at java.base/java.nio.file.Files.newDirectoryStream(Files.java:481) at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:301) at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:374) at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:83) ... 28 more java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:67) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:261) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:190) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) at java.base/java.lang.Thread.run(Thread.java:1583) Caused by: java.lang.reflect.InvocationTargetException at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:118) at java.base/java.lang.reflect.Method.invoke(Method.java:580) at org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$null$0(GenericEndpoint.java:65) ... 11 more Caused by: java.io.UncheckedIOException: java.nio.file.AccessDeniedException: /home/user/.local/share/containers/storage/overlay/105cf5ff6b6f910a74c1313e5c07f66bec08ef44306c587370f8084fb84ac074/work/work at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:87) at java.base/java.nio.file.FileTreeIterator.hasNext(FileTreeIterator.java:103) at java.base/java.util.Iterator.forEachRemaining(Iterator.java:132) at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1939) at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509) at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499) at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151) at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174) at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234) at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596) at net.prominic.groovyls.config.CompilationUnitFactory.addDirectoryToCompilationUnit(CompilationUnitFactory.java:164) at net.prominic.groovyls.config.CompilationUnitFactory.create(CompilationUnitFactory.java:98) at net.prominic.groovyls.GroovyServices.createOrUpdateCompilationUnit(GroovyServices.java:413) at net.prominic.groovyls.GroovyServices.setWorkspaceRoot(GroovyServices.java:130) at net.prominic.groovyls.GroovyLanguageServer.initialize(GroovyLanguageServer.java:77) at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ... 13 more Caused by: java.nio.file.AccessDeniedException: /home/user/.local/share/containers/storage/overlay/105cf5ff6b6f910a74c1313e5c07f66bec08ef44306c587370f8084fb84ac074/work/work at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:90) at java.base/sun.nio.fs.UnixException.asIOException(UnixException.java:115) at java.base/sun.nio.fs.UnixFileSystemProvider.newDirectoryStream(UnixFileSystemProvider.java:477) at java.base/java.nio.file.Files.newDirectoryStream(Files.java:481) at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:301) at java.base/java.nio.file.FileTreeWalker.next(FileTreeWalker.java:374) at java.base/java.nio.file.FileTreeIterator.fetchNextIfNeeded(FileTreeIterator.java:83) ... 28 more ```
joshtynjala commented 1 month ago

This is the real exception:

Caused by: java.lang.IllegalArgumentException: URI has an authority component

Something is wrong with one of the URIs that you pass to the language server. It's saying that the URI has an "authority component", which I think basically means that it might have a domain name or IP address? However, this should be a file URI.

I would look at what the result of lsp#utils#path_to_uri('.') is. I suspect that this might be generating a bad URI.

Caused by: java.nio.file.AccessDeniedException: /home/user/.local/share/containers/storage/overlay/105cf5ff6b6f910a74c1313e5c07f66bec08ef44306c587370f8084fb84ac074/work/work

This exception seems pretty straightforward. The language server does not have permission to access this directory, for some reason.

Jorenar commented 1 month ago

Oooh, okay, yeah, I somehow didn't connect the dots to deduce the server tries to analyze subdirs, so if I test it from $HOME, it searches my every file.

After putting the test file in its own directory everything seems to work. Sorry for false alarm, and thanks a lot for answer!