question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Empty responses sent by Java Language Server on almost all actions like autocomplete, definition inspection caused by Apache Flink archetype

See original GitHub issue

All code completion, suggestions, definition inspections, etc. are not working because the Java Language Server is returning an empty response on all requests. Important to note is that I’m using VS Code Remote with WSL.

I’m not sure if the problem lies in the extension or the LS. If it becomes obvious that the problem is in the server, I will create a ticket in that repository.

Environment
  • Operating System: Windows 10 (1903) in combination with WSL 1.0 Ubuntu 18.04.3
  • JDK version: 11.0.5 (installed in WSL)
  • Visual Studio Code version: 1.41.1
  • Java extension version: 0.8.1
Steps To Reproduce
  1. Create a simple Java file in WSL
  2. Open VS Code with the remote extension connected to WSL
  3. Open the Java file in VS Code remote
  4. Begin typing any Java code, or hover over any existing Java code
Current Result

In the case of autocompletion, no suggestions in the context of Java code is given. In the case of definition dialogs, these are not even shown. There is no response from VS Code whatsoever.

Expected Result

Autocompletion fields with Java related code is shown; information dialogs when hovering over existing classes is presented. Just generally everything that is shown in the Features GIF in the README.

Additional Informations

The Java Runtime is set to the JDK_HOME path as set in WSL, and it looks like the extension can find and use the runtime.

The (simple) Java project that I’m using for this ticket is the Apache Flink tutorial project (which can be found here). When using the completed code as a reference, one would assume that hovering over simple stuff like StreamExecutionEnvironment would show a definition. Or on a newline start typing Math. would show an autocomplete field with Math methods. However, nothing is shown. When I turn on message tracing between the extension and the LS, I can see that requests are made for every action, but on almost all actions the server returns an empty response.

For example, here is a snippet of several actions:

[Trace - 3:54:12 PM] Sending request 'java/findLinks - (38)'.
Params: {
    "type": "superImplementation",
    "position": {
        "textDocument": {
            "uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
        },
        "position": {
            "line": 10,
            "character": 27
        }
    }
}


[Trace - 3:54:12 PM] Received response 'java/findLinks - (38)' in 4ms.
Result: []


[Trace - 3:54:12 PM] Sending request 'textDocument/documentHighlight - (39)'.
Params: {
    "textDocument": {
        "uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
    },
    "position": {
        "line": 10,
        "character": 28
    }
}


[Trace - 3:54:12 PM] Received response 'textDocument/documentHighlight - (39)' in 3ms.
Result: []


[Trace - 3:54:12 PM] Sending request 'textDocument/codeAction - (40)'.
Params: {
    "textDocument": {
        "uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
    },
    "range": {
        "start": {
            "line": 10,
            "character": 28
        },
        "end": {
            "line": 10,
            "character": 28
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 3:54:12 PM] Received response 'textDocument/codeAction - (40)' in 3ms.
Result: []


[Trace - 4:06:35 PM] Sending request 'textDocument/codeAction - (41)'.
Params: {
    "textDocument": {
        "uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
    },
    "range": {
        "start": {
            "line": 16,
            "character": 24
        },
        "end": {
            "line": 16,
            "character": 24
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 4:06:35 PM] Received response 'textDocument/codeAction - (41)' in 4ms.
Result: []


[Trace - 4:11:10 PM] Sending request 'textDocument/codeAction - (42)'.
Params: {
    "textDocument": {
        "uri": "file:///home/tt/flink-wiki-tutorial/wiki-edits/src/main/java/wikiedits/WikipediaAnalysis.java"
    },
    "range": {
        "start": {
            "line": 6,
            "character": 61
        },
        "end": {
            "line": 6,
            "character": 61
        }
    },
    "context": {
        "diagnostics": []
    }
}


[Trace - 4:11:10 PM] Received response 'textDocument/codeAction - (42)' in 5ms.
Result: []

Edit: I should note that I’ve also tried cleaning the LS workspace directory. Unfortunately, this did not solve my problems.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (1 by maintainers)

github_iconTop GitHub Comments

6reactions
fbriconcommented, Feb 18, 2020

After creating a project from the com.alibaba.blink:flink-quickstart-java:1.5.1 archetype, I managed to reproduce the problem. Whoever created that archetype misunderstands how Maven support works in Eclipse and added some configuration that actually breaks Java support in both Eclipse and vscode-java.

Please remove this snippet from the pom.xml:

<pluginExecution>
	<pluginExecutionFilter>
		<groupId>org.apache.maven.plugins</groupId>
		<artifactId>maven-compiler-plugin</artifactId>
		<versionRange>[3.1,)</versionRange>
		<goals>
			<goal>testCompile</goal>
			<goal>compile</goal>
		</goals>
	</pluginExecutionFilter>
	<action>
		<ignore/>
	</action>
</pluginExecution>
0reactions
UnrealKazucommented, Feb 18, 2020

@fbricon Removing the snippet works, indeed! The same solution works for the Apache archetype (as Alibaba forked it from Apache). I’ll open an issue in their repository to discuss whether this is something they want to solve (or mention in the docs).

Thanks for your time!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Search Results - CVE
A vulnerability in Batik of Apache XML Graphics allows an attacker to run untrusted Java code from an SVG. This issue affects Apache...
Read more >
[jira] [Work logged] (BEAM-3900) Introduce Euphoria Java 8 ...
+will not succeed due to some tools (like gcloud) and credentials missing. ... +You can utilize scripts in this folder to build Docker...
Read more >
Getting Started With Karate Test Framework for API
However, in this tutorial I will show you how to run Karate test cases with IntelliJ IDEA as well, because it's one of...
Read more >
Baeldung Author
Less footprint with Project Leyden, observability in Spring Boot 3, Hibernate 6 migration, high-performance java serialization, and logical replication! Read ...
Read more >
frequent-classes - CodaLab Worksheets
... 7071 feature 7053 actions 7032 helper 6985 16 6902 m 6887 font 6884 number 6803 black 6799 15 6779 us 6767 skip...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found