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:

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
- Go to https://micronaut.io/launch
- Use default settings, except change “Application Type” to “Command Line Application” and change “Build” to “Maven”.
- “Click GENERATE PROJECT”. Save as zip file to computer.
- Unzip and open project in VS Code.
- Make any change to
DemoCommand.java
and save the file.
- 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:

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.
Java LS (VS Code) uses m2e