Skip to content

Java code compilation not identify the classpath #772

Closed

Description

@jeypitchai

I'm experiencing java code compilation issue when using VSCode version mention below, I could not use any maven dependency also. The extension always taking me to the page https://github.com/redhat-developer/vscode-java/wiki/%22Classpath-is-incomplete%22-warning

Environment
  • Operating System: macOS Mojave
  • JDK version: 1.8.0_192
  • Visual Studio Code version: 1.30.2
  • Java extension version: Language Support for Java v0.37.0

screen shot 2019-01-22 at 1 14 37 pm

screen shot 2019-01-22 at 1 14 53 pm

Activity

  1. fbricon commented on Jan 22, 2019

    @fbricon
    Collaborator

    can you please attach the server logs

  2. jeypitchai commented on Jan 23, 2019

    @jeypitchai
    Author

    @fbricon
    Server log

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:20.666
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:20.667
    !MESSAGE >> workspace/executeCommand java.resolvePath

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:20.872
    !MESSAGE >> workspace/executeCommand vscode.java.test.search.codelens

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:20.873
    !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:20.874
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:20.877
    !MESSAGE >> document/documentSymbol

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:21.348
    !MESSAGE >> document/hover

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.220
    !MESSAGE >> document/didOpen

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.223
    !MESSAGE Classpath is incomplete. Only syntax errors will be reported for file:///Users/jeypitch/development/infrastructure/stealthwatch/svc-sw-manager/lib-sw-manager-client/src/main/java/com/lancope/sws/smcClient/SMCClientConstants.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.229
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.270
    !MESSAGE >> workspace/executeCommand java.resolvePath

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.597
    !MESSAGE >> workspace/executeCommand vscode.java.test.search.codelens

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.598
    !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.603
    !MESSAGE >> document/documentSymbol

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.767
    !MESSAGE begin problem for /SmcClientLoader.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.768
    !MESSAGE 0 problems reported for /SmcClientLoader.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.791
    !MESSAGE begin problem for /SMCNativeClient.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:23.792
    !MESSAGE 0 problems reported for /SMCNativeClient.java

    !ENTRY org.eclipse.core.jobs 4 2 2019-01-22 23:14:23.793
    !MESSAGE An internal error occurred during: "Validate documents".
    !STACK 0
    java.lang.NullPointerException
    at org.eclipse.jdt.ls.core.internal.ResourceUtils.fixURI(ResourceUtils.java:172)
    at org.eclipse.jdt.ls.core.internal.JDTUtils.getFileURI(JDTUtils.java:598)
    at org.eclipse.jdt.ls.core.internal.JDTUtils.toURI(JDTUtils.java:589)
    at org.eclipse.jdt.ls.core.internal.handlers.DiagnosticsHandler.(DiagnosticsHandler.java:47)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler.publishDiagnostics(DocumentLifeCycleHandler.java:167)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler.performValidation(DocumentLifeCycleHandler.java:160)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler.access$0(DocumentLifeCycleHandler.java:134)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler$1.runInWorkspace(DocumentLifeCycleHandler.java:102)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:25.066
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:29.519
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:33.361
    !MESSAGE >> workspace/executeCommand java.resolvePath

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:45.670
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:45.671
    !MESSAGE >> workspace/executeCommand java.resolvePath

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:45.894
    !MESSAGE >> workspace/executeCommand vscode.java.test.search.codelens

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:45.895
    !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:45.897
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:45.899
    !MESSAGE >> document/documentSymbol

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:47.740
    !MESSAGE >> document/didClose

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:47.750
    !MESSAGE Clearing problems for /SMCNativeClient.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:47.751
    !MESSAGE >> workspace/executeCommand java.resolvePath

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:48.734
    !MESSAGE >> document/didOpen

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:48.744
    !MESSAGE Classpath is incomplete. Only syntax errors will be reported for file:///Users/jeypitch/development/infrastructure/stealthwatch/svc-sw-manager/lib-sw-manager-client/src/main/java/com/lancope/sws/smcClient/SMCNativeClient.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:48.749
    !MESSAGE >> document/codeAction

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:48.750
    !MESSAGE >> workspace/executeCommand java.resolvePath

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:48.977
    !MESSAGE >> workspace/executeCommand vscode.java.test.search.codelens

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:48.978
    !MESSAGE >> workspace/executeCommand vscode.java.resolveMainMethod

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:49.020
    !MESSAGE >> document/documentSymbol

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:49.253
    !MESSAGE begin problem for /SmcClientLoader.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:49.254
    !MESSAGE 0 problems reported for /SmcClientLoader.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:49.281
    !MESSAGE begin problem for /SMCNativeClient.java

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:49.282
    !MESSAGE 0 problems reported for /SMCNativeClient.java

    !ENTRY org.eclipse.core.jobs 4 2 2019-01-22 23:14:49.283
    !MESSAGE An internal error occurred during: "Validate documents".
    !STACK 0
    java.lang.NullPointerException
    at org.eclipse.jdt.ls.core.internal.ResourceUtils.fixURI(ResourceUtils.java:172)
    at org.eclipse.jdt.ls.core.internal.JDTUtils.getFileURI(JDTUtils.java:598)
    at org.eclipse.jdt.ls.core.internal.JDTUtils.toURI(JDTUtils.java:589)
    at org.eclipse.jdt.ls.core.internal.handlers.DiagnosticsHandler.(DiagnosticsHandler.java:47)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler.publishDiagnostics(DocumentLifeCycleHandler.java:167)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler.performValidation(DocumentLifeCycleHandler.java:160)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler.access$0(DocumentLifeCycleHandler.java:134)
    at org.eclipse.jdt.ls.core.internal.handlers.DocumentLifeCycleHandler$1.runInWorkspace(DocumentLifeCycleHandler.java:102)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:42)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:49.617
    !MESSAGE >> document/hover

    !ENTRY org.eclipse.jdt.ls.core 1 0 2019-01-22 23:14:56.358
    !MESSAGE >> workspace/executeCommand java.resolvePath

  3. jeypitchai commented on Jan 25, 2019

    @jeypitchai
    Author

    @fbricon do you have any idea

  4. robstryker commented on Nov 2, 2026

    @robstryker
    Contributor

    Seems an NPE blows away your stack. Looking back at the code that failed, a guard doesn't exist in the Jan 2019 code — it was added in commit 3c6da12d, Nov 21 2019, titled "HoverHandlerTest.testHoverOnPackageWithJavadoc fails" (an odd commit message for the fix, but the diff is exactly this null check). So back when this issue was filed, fixURI crashed unconditionally whenever it was handed a null URI.

    Speculation on the trigger: getFileURI(IResource) calls resource.getRawLocationURI(), falling back to resource.getLocationURI() — both returned null here. That happens for resources without a resolvable filesystem location: a phantom/out-of-sync resource, or (more likely given the Maven multi-module project and the "classpath incomplete" symptom) a CompilationUnit belonging to a project whose Maven import didn't fully settle, leaving its resource in a transient state when the reconciler tried to validate it. Note the log shows rapid didClose/didOpen cycling on the same files within ~1 second — a plausible window for a resource to be momentarily inconsistent when diagnostics validation runs concurrently.

    Net effect: the NPE kills the "Validate documents" job for that file, so diagnostics (including classpath-related problem markers) silently never get published for it — which would look exactly like "classpath not being recognized" from the user's perspective, even though the real root cause is unrelated to classpath resolution itself; it's a diagnostics-publishing crash.

    Closing as likely fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions