Git Product home page Git Product logo

Comments (30)

snjeza avatar snjeza commented on September 23, 2024 1

Thanks for your response! Unfortunately it didn't work for me.

Could you try to set

...
                "runtimes": [
                    {
                        "name": "JavaSE-17",
                        "path": "/usr/lib/jvm/java-17-openjdk",
                        "javadoc": "https://docs.oracle.com/en/java/javase/17/docs/api/",
                        "default": true
                    }
...

Could you access JDK 17 API?

You can also try to install the JDK source.

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024 1

Thanks for your response! Unfortunately it didn't work for me.

Could you try to set

...
                "runtimes": [
                    {
                        "name": "JavaSE-17",
                        "path": "/usr/lib/jvm/java-17-openjdk",
                        "javadoc": "https://docs.oracle.com/en/java/javase/17/docs/api/",
                        "default": true
                    }
...

Could you access JDK 17 API?

You can also try to install the JDK source.

Thanks @snjeza . Yes, that's what I meant, but forgot to include the actual javadoc property that controls this 😆 . I think some distributions simply provide a separate source bundle for the JDK which eliminates the need for a javadoc bundle (assuming the space taken by the sources is not an issue).

from eclipse.jdt.ls.

cypher256 avatar cypher256 commented on September 23, 2024 1

JDT will give priority to Javadoc in the source even if a Javadoc URL is specified.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=549029

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024 1
[Error - 16:30:18] Jun. 3, 2024, 4:30:18 p.m. java.net.ConnectException
	at java.net.http/jdk.internal.net.http.HttpClientImpl.send(Unknown Source)
	at java.net.http/jdk.internal.net.http.HttpClientFacade.send(Unknown Source)
	at org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.find(MavenCentralIdentifier.java:119)
	at org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.identifySha1(MavenCentralIdentifier.java:81)
	at org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.identify(MavenCentralIdentifier.java:72)
	at org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.identify(MavenCentralIdentifier.java:58)
	at org.eclipse.jdt.ls.core.internal.managers.MavenSourceDownloader.discoverSource(MavenSourceDownloader.java:78)
	at org.eclipse.jdt.ls.core.internal.managers.InvisibleProjectBuildSupport.discoverSource(InvisibleProjectBuildSupport.java:103)
	at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeHover(HoverInfoProvider.java:135)
	at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.computeHover(HoverHandler.java:57)
	at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.hover(HoverHandler.java:43)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$5(JDTLanguageServer.java:654)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.scan(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(Unknown Source)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(Unknown Source)
Caused by: java.net.ConnectException
	at java.net.http/jdk.internal.net.http.common.Utils.toConnectException(Unknown Source)
	at java.net.http/jdk.internal.net.http.PlainHttpConnection.connectAsync(Unknown Source)
	at java.net.http/jdk.internal.net.http.AsyncSSLConnection.connectAsync(Unknown Source)
	at java.net.http/jdk.internal.net.http.Http2Connection.createAsync(Unknown Source)
	at java.net.http/jdk.internal.net.http.Http2ClientImpl.getConnectionFor(Unknown Source)
	at java.net.http/jdk.internal.net.http.ExchangeImpl.get(Unknown Source)
	at java.net.http/jdk.internal.net.http.Exchange.establishExchange(Unknown Source)
	at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl0(Unknown Source)
	at java.net.http/jdk.internal.net.http.Exchange.responseAsyncImpl(Unknown Source)
	at java.net.http/jdk.internal.net.http.Exchange.responseAsync(Unknown Source)
	at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(Unknown Source)
	at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsyncImpl$7(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.uniHandle(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.uniHandleStage(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.handle(Unknown Source)
	at java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(Unknown Source)
	at java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsync0$2(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(Unknown Source)
	at java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(Unknown Source)
	at java.base/java.util.concurrent.CompletableFuture.completeAsync(Unknown Source)
	at java.net.http/jdk.internal.net.http.MultiExchange.responseAsync(Unknown Source)
	at java.net.http/jdk.internal.net.http.HttpClientImpl.sendAsync(Unknown Source)
	... 20 more
Caused by: java.nio.channels.UnresolvedAddressException
	at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
	at java.base/sun.nio.ch.Net.checkAddress(Unknown Source)
	at java.base/sun.nio.ch.SocketChannelImpl.checkRemote(Unknown Source)
	at java.base/sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
	at java.net.http/jdk.internal.net.http.PlainHttpConnection.lambda$connectAsync$0(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	... 43 more

You're absolutely right. I got the exact same stacktrace on VS Code. The relevant code attempts to fetch the sources in order to compute the javadoc, but obviously if you disable your network interface, this fails, and we don't handle it gracefully. I think this should be easy to fix. though.

Update: The error is logged at

so the error doesn't interrupt execution, and likely the problem has to do with what occurs after. I'll need to investigate further.

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024

From https://github.com/eclipse-jdtls/eclipse.jdt.ls/wiki/Running-the-JAVA-LS-server-from-the-command-line#initialize-request :
You can try configuring this with java.configuration.runtimes :

"settings": {
        "java": {
            ...
            ...
            "configuration": {
                ...
                ...
                "runtimes": [
                    {
                        "name": "JavaSE-17",
                        "path": "/usr/lib/jvm/java-17-openjdk",
                        "default": true
                    }
            }
        }
}

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

@rgrunber Thanks for your response! Unfortunately it didn't work for me.

Looks like the class ClasspathEntry is responsible for configuration, however I didn't find out how to use it.

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024

What client are you using to consume JDT-LS ? Any of the ones mentioned at https://github.com/eclipse-jdtls/eclipse.jdt.ls/#clients ? Where is the ClasspathEntry you're referring to ?

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

@rgrunber thanks for your patience.
I am using Monaco-languageclient for consumption, the file for ClaspathEntry is org.eclipse.jdt.internal.core.ClasspathEntry.

How did I encounter this:
I received error log messages from the client side while requesting a text document for the System object (by hovering over code in the editor). The error stated that due to network unavailability, it couldn't retrieve documents from the Internet.

Upon investigating the error message, I discovered that the error is thrown from org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc. In this method, the document is requested from the location specified by the value of javadoc_location.

Specifically, in the method org.eclipse.jdt.internal.core.JavaElement.getLibraryJavadocLocation, the value is set in the constructor of org.eclipse.jdt.internal.core.ClasspathEntry as the IClasspathAttribute[] extraAttributes parameter.

Given its name, ClasspathEntry, it seems like a configurable object. Hence, I posted my question here.

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

Init requst:

{
  "..." : "...",
  "params":{
    "..." : "...",
    "initilizationOptions": {
      "settings": {
        "java": {
          "configuration": {
            "runtime": {
              "name": "JavaSE-11",
              "path": "/usr/lib/jvm/java-11-openjdk-amd64",
              "javadoc": "file:///usr/share/doc/openjdk-11-doc/api/",
              "default": true
            }
          }
        }
      }
    }
  }
}

But it did not prevent me from getting error message (requesting docs from Internet) as:

Nov 24, 2023, 7:30:06 AM docs.oracle.com\ndocs.oracle.com\nJava Model Exception: java.net.UnknownHostException: docs.oracle.com
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:941)
at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1090)
at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:1047)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:603)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getMarkdownContentReader(JavadocContentAccess2.java:2607)
at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeJavadoc(HoverInfoProvider.java:311)
at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeHover(HoverInfoProvider.java:150)
at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.computeHover(HoverHandler.java:57)
at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.hover(HoverHandler.java:43)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$7(JDTLanguageServer.java:580)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\nCaused by: java.net.UnknownHostException: docs.oracle.com
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:305)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:508)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:373)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:207)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:193)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:874)
... 17 more\nCaused by: java.net.UnknownHostException: docs.oracle.com
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:229)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.base/java.net.Socket.connect(Socket.java:609)
at java.base/sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:305)
at java.base/sun.net.NetworkClient.doConnect(NetworkClient.java:177)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:508)
at java.base/sun.net.www.http.HttpClient.openServer(HttpClient.java:603)
at java.base/sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:266)
at java.base/sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:373)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:207)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1187)
at java.base/sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1081)
at java.base/sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:193)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1592)
at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1520)
at java.base/java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:527)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:334)
at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:874)
at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1090)
at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:1047)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:603)
at org.eclipse.jdt.ls.core.internal.javadoc.JavadocContentAccess2.getMarkdownContentReader(JavadocContentAccess2.java:2607)
at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeJavadoc(HoverInfoProvider.java:311)
at org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeHover(HoverInfoProvider.java:150)
at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.computeHover(HoverHandler.java:57)
at org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.hover(HoverHandler.java:43)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$7(JDTLanguageServer.java:580)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024

Java Model Exception: java.net.UnknownHostException: docs.oracle.com

I think the above error might be some DNS issue. It worked for me to have the javadoc downloaded from the remote location. The final URL requested is something like https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/lang/String.html (assuming you hover over the String type), which is valid.

As for why it didn't respect your setting, the format you provided just needs to be adjusted as we only support java.configuration.runtimes as a list of runtime elements.

"runtime": {
        "name": "JavaSE-11",
        "path": "/usr/lib/jvm/java-11-openjdk-amd64",
        "javadoc": "file:///usr/share/doc/openjdk-11-doc/api/",
        "default": true
    }

should become :

"runtimes": [
        {
            "name": "JavaSE-11",
            "path": "/usr/lib/jvm/java-11-openjdk-amd64",
            "javadoc": "file:///usr/share/doc/openjdk-11-doc/api/",
            "default": true
        }
    ]

See

List<?> runtimeList = getList(configuration, JAVA_CONFIGURATION_RUNTIMES, JAVA_CONFIGURATION_RUNTIMES_DEFAULT);
.

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

I fixed the runtime and it looks like this now:

{
    "params":{
        "initializationOptions":{
            "settings": {
                "java": {
                    "configuration": {
                        "runtime": [
                            {
                                "name": "JavaSE-17",
                                "path": "/usr/lib/jvm/java-17-openjdk-amd64",
                                "javadoc": "/usr/lib/jvm/java-17-openjdk-amd64/docs/api",
                                "default": true
                            }
                        ]
                    }
                }
            }
        }
    }
}

unfortunately, it still didn't work.

Accroding to

JavaLanguageServerPlugin.logInfo("Invalid javadoc: " + javadoc);
, there will be a exception if the value of javadoc is invalid. However I did not get any error logs while setting a invalid value.

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

@armanim Could you show your .classpath file?

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

@snjeza I didn't find the .classpath file.

I downloaded jdtls from eclipse snapshot repository: jdtls

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

I didn't find the .classpath file.

Could you check your project root directory or <your_workspace>/redhat.java/jdt_ws/.metadata/.plugins/org.eclipse.core.resources/.projects/<your_project_name>/.classpath

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

I didn't find the .classpath file.

Could you check your project root directory or <your_workspace>/redhat.java/jdt_ws/.metadata/.plugins/org.eclipse.core.resources/.projects/<your_project_name>/.classpath

There are two .classpath files.

/jdt.ls.java.project/.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="src" path="src"/>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="output" path="bin"/>
</classpath>

/workspace-xxxx/.classpath

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
        <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
        <classpathentry kind="src" path="_"/>
        <classpathentry kind="output" path="bin"/>
</classpath>

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

Could you try the following:

  • stop your client
  • remove workspace-xxx
  • start your client

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

Could you try the following:

  • stop your client

  • remove workspace-xxx

  • start your client

the workspace-xxx created again. And content of .classpath file is the same.

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

What project are you using? Maven, Gradle, Eclipse?

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

What project are you using? Maven, Gradle, Eclipse?

Single Java file in the workspace directory.

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

Could you try to run

$ ls /usr/lib/jvm/java-17-openjdk-amd64/bin
$ ls /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip

How did you set up monaco-languageclient?

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

Could you try to run

$ ls /usr/lib/jvm/java-17-openjdk-amd64/bin
$ ls /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip

How did you set up monaco-languageclient?

$ ls /usr/lib/jvm/java-17-openjdk-amd64/bin
jar        java   javadoc  jcmd      jdb        jdeps  jhsdb   jinfo  jmap  jpackage  jrunscript  jstack  jstatd   rmiregistry
jarsigner  javac  javap    jconsole  jdeprscan  jfr    jimage  jlink  jmod  jps       jshell      jstat   keytool  serialver

$ ls /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip
/usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip

and src.zip is a invalid link file whick linked to nothing.

$ cat /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip
cat: /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip: No such file or directory

This is how I setup monaco-languageclient

monaco.editor.create(document.getElementById('container')!, {
    model: monaco.editor.createModel(value, 'java', monaco.Uri.parse('file:///tmp/workspace/a.java')),
    glyphMargin: true,
    lightbulb: {
        enabled: true
    }
});

function createLanguageClient (transports: MessageTransports): MonacoLanguageClient {
    return new MonacoLanguageClient({
        name: 'Sample Language Client',
        clientOptions: {
            workspaceFolder: {
                uri: monaco.Uri.parse('file:///tmp/workspace/'),
                name: 'monaco-languageclient',
                index: 0
            },
            documentSelector: ['java'],
            initializationOptions: {
                settings: {
                    java: {
                        configuration: {
                            runtime: [{
                                name: 'JavaSE-17',
                                path: '/usr/lib/jvm/java-17-openjdk-amd64',
                                javadoc: '/usr/lib/jvm/java-17-openjdk-amd64/docs/api',
                                default: true
                            }]
                        }
                    }
                }
            }
        }
    });

And Im using a relatively older version of it. the last commit is fbc2f1e31 from Date: Wed Jun 22 23:00:40 2022 +0200

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

and src.zip is a invalid link file whick linked to nothing.

Could you try

$ ls -l /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip

You can also try to reinstall java-17-openjdk.

from eclipse.jdt.ls.

armanim avatar armanim commented on September 23, 2024

and src.zip is a invalid link file whick linked to nothing.

Could you try

$ ls -l /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip

You can also try to reinstall java-17-openjdk.

$ ls -l /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip
lrwxrwxrwx 1 root root 24 Oct 31 23:39 /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip -> ../../openjdk-17/src.zip

from eclipse.jdt.ls.

snjeza avatar snjeza commented on September 23, 2024

Could you try to run

$ sudo rm -rf /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip
$ sudo ln -s /usr/lib/jvm/openjdk-17/src.zip /usr/lib/jvm/java-17-openjdk-amd64/lib/src.zip 

from eclipse.jdt.ls.

nithin-mk avatar nithin-mk commented on September 23, 2024

What is the proper way to set javadoc in runtimes if the JavaDoc of the JDK is a ZIP file downloaded from Oracle? Is it:

  1. javadoc = "/opt/jdk-21.0.3_doc-all.zip", or
  2. javadoc = "/opt/jdk-21.0.3_doc-all.zip!/docs/api", ?

IntelliJ Idea uses the second notation when I pointed the JavaDoc of the JDK to the ZIP file in Project structure -> SDKs window. (I know that Idea doesn't use JDTLS; just FYI).

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024

I tried a zip file path (1) and that seems to work for me. I think URLs are also supported.

from eclipse.jdt.ls.

nithin-mk avatar nithin-mk commented on September 23, 2024

@rgrunber I tried option 1 after deleting the JDK's src.zip and disconnecting from the Internet. The documentation tooltip in NeoVim did not show the documentation in that case, just the function signature. PFA the screenshot. (I tried option 2 also in the same scenario; that too didn't work.)

@cypher256's comment mentions that the source always gets priority over the Javadoc. I think the Javadoc is not considered in any scenario by jdtls, if it is a ZIP file.
Screenshot 2024-06-01 184724

from eclipse.jdt.ls.

rgrunber avatar rgrunber commented on September 23, 2024

Do you have a sample of what your configuration file looks like for the setting under neovim ?

from eclipse.jdt.ls.

nithin-mk avatar nithin-mk commented on September 23, 2024

Here is my relevant Lua configuration file for NeoVim. I took it from AstroNvim. Jdtls version is 1.35.0.

local home = os.getenv "HOME"

---@type LazySpec
return {
   {
    "mfussenegger/nvim-jdtls",
    opts = {
      settings = {
        java = {
          configuration = {
            runtimes = {
              {
                name = "JavaSE-21",
                path = home .. "/.sdkman/candidates/java/21.0.3-tem",
                javadoc = "/opt/jdk-21.0.3_doc-all.zip",
                default = true,
              },
              {
                name = "JavaSE-17",
                path = home .. "/.sdkman/candidates/java/17.0.11-tem",
              },
              {
                name = "JavaSE-11",
                path = home .. "/.sdkman/candidates/java/11.0.23-tem",
              },
            },
          },
        },
        format = {
          enabled = true,
          settings = { -- you can use your preferred format style
            url = "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml",
            profile = "GoogleStyle",
          },
        },
      },
    },
  },
}

from eclipse.jdt.ls.

nithin-mk avatar nithin-mk commented on September 23, 2024

These are the NeoVim LSP logs.

[START][2024-06-03 19:53:36] LSP logging initiated
[ERROR][2024-06-03 19:53:36] .../vim/lsp/rpc.lua:734	"rpc"	"java"	"stderr"	"WARNING: Using incubator modules: jdk.incubator.vector\n"
[ERROR][2024-06-03 19:53:37] .../vim/lsp/rpc.lua:734	"rpc"	"java"	"stderr"	"Jun 03, 2024 7:53:37 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic\n"
[ERROR][2024-06-03 19:53:37] .../vim/lsp/rpc.lua:734	"rpc"	"java"	"stderr"	"Jun 03, 2024 7:53:37 PM org.apache.aries.spifly.BaseActivator log\nINFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic\n"
[ERROR][2024-06-03 19:53:39] ...lsp/handlers.lua:535	"Jun 3, 2024, 7:53:39 PM Failed to load extension bundles \nLoad bundle list\norg.eclipse.core.runtime.CoreException: Load bundle list\n\tat org.eclipse.jdt.ls.core.internal.handlers.BundleUtils.loadBundles(BundleUtils.java:173)\n\tat org.eclipse.jdt.ls.core.internal.handlers.InitHandler.handleInitializationOptions(InitHandler.java:114)\n\tat org.eclipse.jdt.ls.core.internal.handlers.BaseInitHandler.initialize(BaseInitHandler.java:64)\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.initialize(JDTLanguageServer.java:284)\n\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)\n\tat java.base/java.lang.reflect.Method.invoke(Method.java:580)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.lambda$recursiveFindRpcMethods$0(GenericEndpoint.java:65)\n\tat org.eclipse.lsp4j.jsonrpc.services.GenericEndpoint.request(GenericEndpoint.java:120)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleRequest(RemoteEndpoint.java:272)\n\tat org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:201)\n\tat org.eclipse.jdt.ls.core.internal.ParentProcessWatcher.lambda$1(ParentProcessWatcher.java:144)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194)\n\tat org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94)\n\tat org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113)\n\tat java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572)\n\tat java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)\n\tat java.base/java.lang.Thread.run(Thread.java:1583)\nContains: Failed to get bundleInfo for bundle from /home/fci1614/.local/share/nvim/mason/share/java-test/com.microsoft.java.test.runner-jar-with-dependencies.jar\n"
[WARN][2024-06-03 19:53:41] ...lsp/handlers.lua:137	"The language server jdtls triggers a registerCapability handler despite dynamicRegistration set to false. Report upstream, this warning is harmless"
[ERROR][2024-06-03 19:53:41] ...lsp/handlers.lua:535	"Jun 3, 2024, 7:53:41 PM Command _java.reloadBundles.command not supported on client"
[ERROR][2024-06-03 19:53:41] .../vim/lsp/rpc.lua:734	"rpc"	"java"	"stderr"	"Jun 03, 2024 7:53:41 PM com.microsoft.java.debug.plugin.internal.JavaDebuggerServerPlugin start\nINFO: Starting com.microsoft.java.debug.plugin\n"
[ERROR][2024-06-03 19:53:47] .../vim/lsp/rpc.lua:734	"rpc"	"java"	"stderr"	"Jun 03, 2024 7:53:47 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation\nWARNING: Unmatched cancel notification for request id 14\n"
[ERROR][2024-06-03 19:53:49] .../vim/lsp/rpc.lua:734	"rpc"	"java"	"stderr"	"Jun 03, 2024 7:53:49 PM org.eclipse.lsp4j.jsonrpc.RemoteEndpoint handleCancellation\nWARNING: Unmatched cancel notification for request id 44\n"
[ERROR][2024-06-03 19:54:01] ...lsp/handlers.lua:535	"Jun 3, 2024, 7:54:01 PM HTTP connect timed out\nHTTP connect timed out\njava.net.http.HttpConnectTimeoutException: HTTP connect timed out\n\tat java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:945)\n\tat java.net.http/jdk.internal.net.http.HttpClientFacade.send(HttpClientFacade.java:133)\n\tat org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.find(MavenCentralIdentifier.java:119)\n\tat org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.identifySha1(MavenCentralIdentifier.java:81)\n\tat org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.identify(MavenCentralIdentifier.java:72)\n\tat org.eclipse.jdt.ls.core.internal.managers.MavenCentralIdentifier.identify(MavenCentralIdentifier.java:58)\n\tat org.eclipse.jdt.ls.core.internal.managers.MavenSourceDownloader.discoverSource(MavenSourceDownloader.java:78)\n\tat org.eclipse.jdt.ls.core.internal.managers.MavenBuildSupport.discoverSource(MavenBuildSupport.java:145)\n\tat org.eclipse.jdt.ls.core.internal.HoverInfoProvider.computeHover(HoverInfoProvider.java:135)\n\tat org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.computeHover(HoverHandler.java:57)\n\tat org.eclipse.jdt.ls.core.internal.handlers.HoverHandler.hover(HoverHandler.java:43)\n\tat org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$5(JDTLanguageServer.java:666)\n\tat org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)\n\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)\n\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)\n\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)\n\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)\n\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)\n\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)\n\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)\nCaused by: java.net.http.HttpConnectTimeoutException: HTTP connect timed out\n\tat java.net.http/jdk.internal.net.http.MultiExchange.toTimeoutException(MultiExchange.java:585)\n\tat java.net.http/jdk.internal.net.http.MultiExchange.getExceptionalCF(MultiExchange.java:532)\n\tat java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsyncImpl$7(MultiExchange.java:452)\n\tat java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)\n\tat java.base/java.util.concurrent.CompletableFuture.uniHandleStage(CompletableFuture.java:950)\n\tat java.base/java.util.concurrent.CompletableFuture.handle(CompletableFuture.java:2372)\n\tat java.net.http/jdk.internal.net.http.MultiExchange.responseAsyncImpl(MultiExchange.java:444)\n\tat java.net.http/jdk.internal.net.http.MultiExchange.lambda$responseAsync0$2(MultiExchange.java:346)\n\tat java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)\n\tat java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)\n\tat java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773)\n\tat java.net.http/jdk.internal.net.http.HttpClientImpl$DelegatingExecutor.execute(HttpClientImpl.java:177)\n\tat java.base/java.util.concurrent.CompletableFuture.completeAsync(CompletableFuture.java:2719)\n\tat java.net.http/jdk.internal.net.http.MultiExchange.responseAsync(MultiExchange.java:299)\n\tat java.net.http/jdk.internal.net.http.HttpClientImpl.sendAsync(HttpClientImpl.java:1047)\n\tat java.net.http/jdk.internal.net.http.HttpClientImpl.send(HttpClientImpl.java:930)\n\t... 19 more\nCaused by: java.net.ConnectException: HTTP connect timed out\n\tat java.net.http/jdk.internal.net.http.MultiExchange.toTimeoutException(MultiExchange.java:586)\n\t... 34 more\n"

from eclipse.jdt.ls.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.