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.

Problems Java(0) and Java(16777540) reported with new CLI Micronaut application

See original GitHub issue

I’m getting problems reported on the PROBLEMS tab in VS Code for a brand new application created using Micronaut Launch (https://micronaut.io/launch).

The problems are:

  • The project was not built since its build path is incomplete. Cannot find the class file for io.micronaut.websocket.annotation.WebSocketComponent. Fix the build path then try building this project
  • The type io.micronaut.websocket.annotation.WebSocketComponent cannot be resolved. It is indirectly referenced from required .class files

Their complete messages are long. That’s why I used the codes instead in this issue title.

Even though these problems are reported, I can still click “Run” above public static void main to run the application and I can still run the Maven command compile using the command palette and with the command ./mvnw compile in the integrated terminal. Everything seems to work okay, I just get these problems reported which is distracting.

The red underline in the editor for the problem 16777540 is under just the “p” character of package com.example; at the top.

Screenshot:

image

Environment
  • Operating System: Ubuntu 20.04 running in WSL 2 on Windows 10 Pro
  • JDK version: 11.0.11
  • Visual Studio Code version: 1.56.2
  • Java extension version: v0.14.0 (extension pack)
Steps To Reproduce
  1. Go to https://micronaut.io/launch
  2. Use default settings, except change “Application Type” to “Command Line Application” and change “Build” to “Maven”.
  3. “Click GENERATE PROJECT”. Save as zip file to computer.
  4. Unzip and open project in VS Code.
  5. Make any change to DemoCommand.java and save the file.
  6. Observe problems reported.

Preproduction repo: https://github.com/mattwelke/vs-code-java-micronaut-error-report

Logs:

For VS Code dev tools logs, there is no log output when I reproduce the issue (by making any change to the file and saving it).

For Java extension logs, this was recorded in the file:

{ message: 'Starting Java server with: /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -noverify -jar /home/matt/.vscode-server/extensions/redhat.java-0.79.1/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /home/matt/.vscode-server/data/User/globalStorage/redhat.java/0.79.1/config_ss_linux -data /home/matt/.vscode-server/data/User/workspaceStorage/4af29634ea2a8727d86b9ba119e4eadb/redhat.java/ss_ws', level: 'info', timestamp: '2021-05-16 20:44:44.153' } { message: 'Starting Java server with: /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -noverify -jar /home/matt/.vscode-server/extensions/redhat.java-0.79.1/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /home/matt/.vscode-server/data/User/globalStorage/redhat.java/0.79.1/config_linux -data /home/matt/.vscode-server/data/User/workspaceStorage/4af29634ea2a8727d86b9ba119e4eadb/redhat.java/jdt_ws', level: 'info', timestamp: '2021-05-16 20:44:44.181' } { message: 'Starting Java server with: /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -noverify -jar /home/matt/.vscode-server/extensions/redhat.java-0.79.1/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /home/matt/.vscode-server/data/User/globalStorage/redhat.java/0.79.1/config_ss_linux -data /home/matt/.vscode-server/data/User/workspaceStorage/4af29634ea2a8727d86b9ba119e4eadb/redhat.java/ss_ws', level: 'info', timestamp: '2021-05-16 20:47:30.125' } { message: 'Starting Java server with: /usr/lib/jvm/java-11-openjdk-amd64/bin/java --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dfile.encoding=utf8 -XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx1G -Xms100m -noverify -jar /home/matt/.vscode-server/extensions/redhat.java-0.79.1/server/plugins/org.eclipse.equinox.launcher_1.6.100.v20201223-0822.jar -configuration /home/matt/.vscode-server/data/User/globalStorage/redhat.java/0.79.1/config_linux -data /home/matt/.vscode-server/data/User/workspaceStorage/4af29634ea2a8727d86b9ba119e4eadb/redhat.java/jdt_ws', level: 'info', timestamp: '2021-05-16 20:47:30.160' } { message: '[Error - 8:47:34 PM] May 16, 2021, 8:47:34 PM Problem with folding range for /demo_c90b84bd/_/src/main/java/com/example/DemoCommand.java\n' + "_/src/main/java/com/example [in demo_c90b84bd] is not on its project's build path\n" + "Java Model Exception: Java Model Status [_/src/main/java/com/example [in demo_c90b84bd] is not on its project's build path]\n" + '\tat org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:583)\n' + '\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:254)\n' + '\tat org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:528)\n' + '\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:248)\n' + '\tat org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:528)\n' + '\tat org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1240)\n' + '\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:248)\n' + '\tat org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)\n' + '\tat org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:326)\n' + '\tat org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:312)\n' + '\tat org.eclipse.jdt.internal.core.CompilationUnit.getSourceRange(CompilationUnit.java:955)\n' + '\tat org.eclipse.jdt.ls.core.internal.handlers.FoldingRangeHandler.computeFoldingRanges(FoldingRangeHandler.java:77)\n' + '\tat org.eclipse.jdt.ls.core.internal.handlers.FoldingRangeHandler.foldingRange(FoldingRangeHandler.java:68)\n' + '\tat org.eclipse.jdt.ls.core.internal.syntaxserver.SyntaxLanguageServer.lambda$5(SyntaxLanguageServer.java:315)\n' + '\tat org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)\n' + '\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)\n' + '\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\n', level: 'info', timestamp: '2021-05-16 20:47:34.336' } { message: '[Error - 8:47:34 PM] May 16, 2021, 8:47:34 PM Problem with folding range for /demo_c90b84bd/_/src/main/java/com/example/DemoCommand.java\n' + "_/src/main/java/com/example [in demo_c90b84bd] is not on its project's build path\n" + "Java Model Exception: Java Model Status [_/src/main/java/com/example [in demo_c90b84bd] is not on its project's build path]\n" + '\tat org.eclipse.jdt.internal.core.JavaElement.newJavaModelException(JavaElement.java:583)\n' + '\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:254)\n' + '\tat org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:528)\n' + '\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:248)\n' + '\tat org.eclipse.jdt.internal.core.Openable.openAncestors(Openable.java:528)\n' + '\tat org.eclipse.jdt.internal.core.CompilationUnit.openAncestors(CompilationUnit.java:1240)\n' + '\tat org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:248)\n' + '\tat org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)\n' + '\tat org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:326)\n' + '\tat org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:312)\n' + '\tat org.eclipse.jdt.internal.core.CompilationUnit.getSourceRange(CompilationUnit.java:955)\n' + '\tat org.eclipse.jdt.ls.core.internal.handlers.FoldingRangeHandler.computeFoldingRanges(FoldingRangeHandler.java:77)\n' + '\tat org.eclipse.jdt.ls.core.internal.handlers.FoldingRangeHandler.foldingRange(FoldingRangeHandler.java:68)\n' + '\tat org.eclipse.jdt.ls.core.internal.syntaxserver.SyntaxLanguageServer.lambda$5(SyntaxLanguageServer.java:315)\n' + '\tat org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)\n' + '\tat java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)\n' + '\tat java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)\n' + '\tat java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)\n' + '\tat java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)\n', level: 'info', timestamp: '2021-05-16 20:47:34.524' } { message: '[Error - 9:01:29 PM] May 16, 2021, 9:01:29 PM Unable to load IDecompiler class for jarFileContentProvider', level: 'info', timestamp: '2021-05-16 21:01:29.239' }
Current Result

Code can be compiled with Maven and can be run with process runner, but displays distracting problems that may or may not be false positives.

Expected Result

Given that it’s a starter application generated with a Maven build system, and VS Code supports Maven Java projects, the expected result is that I’m able to open it and not get any error messages.

Additional info

When googling around for this, I saw people talk about it having to do with how they’d configured Java for VS Code. If I go to “Configure Java Runtime” via the command palette, here’s what I see:

image image image

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mattwelkecommented, May 18, 2021

Thanks for the link. I know that I have a lot of reading up on things to do, since I still need to understand how VS Code works with Maven. But what would help me know where to look right now is to know what the issue in this case was. Did the Micronaut app created lack a Maven dependency it needs? Or is it that I didn’t set up VS Code and m2e enough for this particular kind of app? Basically I want to know whether there’s an issue with Micronaut’s stuff or my understanding.

0reactions
snjezacommented, May 18, 2021

Is the problem here that Maven isn’t used directly by VS Code, and instead it uses other tooling (you mention Eclipse JDT), and so I need to get it set up so that Eclipse JDT has access to the dependency at compile time?

Java LS (VS Code) uses m2e

Read more comments on GitHub >

github_iconTop Results From Across the Web

Upgrade to Micronaut 3.1.1 breaks cli application native ...
Expected Behavior After following the Micronaut upgrade guide instructions I expected the compiled native binary to execute as before.
Read more >
Micronaut Framework 3.7.0 Released!
The Micronaut team is excited to announce the release of Micronaut framework 3.7.0! This release introduces a lot of new features to the ......
Read more >
redhat-developer - Bountysource
Created 3 years ago in redhat-developer/vscode-java with 20 comments. ... Problems Java(0) and Java(16777540) reported with new CLI Micronaut application $ ...
Read more >
Getting error on shutdown of simple Micronaut CLI data ...
Instead of dbcp, when I used Hikari (jdbc-hikari) the problem went away. So looks like some issue with jdbc-dbcp data source ...
Read more >
Building stackoverflow-cli with Java 11, Micronaut, Picocli, and ...
In this blog post, I show you how to build stackoverflow-cli - a command-line application that allows you to search Stack Overflow questions ......
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