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.

Java LS "Classpath is incomplete" warning when loading petclinic

See original GitHub issue

Description

After I have created a workspace using the following devfile

---
specVersion: 0.0.1
name: petclinic-dev-environment
projects:
  - name: petclinic
    source:
      type: git
      location: 'https://github.com/spring-projects/spring-petclinic.git'
components:
  - type: kubernetes
    alias: mvn-container
    reference: https://gist.githubusercontent.com/l0rd/52eda1d1b57878a218cba17c0c93a477/raw/9a2d56e777d22e77c25c45744caea35bb62d8688/petclinic.yaml
    selector:
      app.kubernetes.io/component: webapp
  - type: kubernetes
    reference: https://gist.githubusercontent.com/l0rd/52eda1d1b57878a218cba17c0c93a477/raw/9a2d56e777d22e77c25c45744caea35bb62d8688/petclinic.yaml
    selector:
      app.kubernetes.io/component: database
  - type: chePlugin
    id: redhat/java/0.45.0
  - type: chePlugin
    id: redhat/vscode-yaml/0.4.0
commands:
  - name: build
    actions:
      - type: exec
        component: mvn-container
        command: mvn package
        workdir: /projects/spring-petclinic

a classpath incomplete warning is shown every time a Java file is opened:

image

Reproduction Steps

Start a workspace using this devfile:

chectl workspace:start --devfile=https://gist.githubusercontent.com/l0rd/52eda1d1b57878a218cba17c0c93a477/raw/8ef7ff447a7164215395d6bc7d70b49363ebae86/devfile.yaml

OS and version:

macOS / minikube / nightly che-server / chectl / helm / jtd ls 0.45.0

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:42 (41 by maintainers)

github_iconTop GitHub Comments

1reaction
sunixcommented, Sep 13, 2019
1reaction
JPinkneycommented, Aug 9, 2019

Since this is the last blocker I wanted to do a write up explaining everything I’ve found so far:

First, I’m not sure if the issue has disappeared as a result of some other fix or if there’s another issue that’s the problem such as internet speed etc because I cannot reproduce on 7.0.0 rc 5 with latest che-theia using the devfile given. However, I can reproduce the issue by changing the devfile to clone no projects and then running > git clone https://github.com/spring-projects/spring-petclinic in the command palette when theia is loaded.

But in an attempt to switch to multi root workspaces to mitigate this in the future, with the multi root workspace code Thomas gave me [1] there seems to be a race condition between when the git clone happens and when the java language server registers the workspace/didUpdateWorkspaceFolders with the client. It seems to me that if a project is finished cloning before the java language server sends client/registerCapability with workspace/didUpdateWorkspaceFolders to the client then the client doesn’t actually send the changed folder to the java language server. I believe this is the reason why cloning a small java project such as the https://github.com/che-samples/console-java-simple will get a classpath issue with these new code changes. However, if you are trying to clone a larger java project, such as https://github.com/angelozerr/lsp4xml it does not seem to be the case and you won’t get the classpath issue.

I believe this issue is caused because che-7.0.0 theia branch does not have the vscode activation events implemented and thus vscode-java is getting started on workspace start which is then starting the java language server, rather than vscode-java waiting to start by using the activation events defined in the plugin. My thoughts are that if activation events were working the java language server would not start eagerly. Then we can trigger the cloning of all projects and then update the workspace root. Then and only then, the language server initialization would start (because the activation events would be triggered), rather than it starting eagerly like it does now. If all the projects are cloned before the server is started then the workspaceFolders in initialialization will be sent correctly to the server and then all will proceed as expected. Additionally, if any projects are cloned after this, the client would then send a workspace/updateWorkspaceFolders event and the language server will handle the new folder. I believe this should resolve the race condition.

Just from quickly inspecting a few of the vscode language plugins supported in Che, it seems like they have reasonable activation events such as activating when a language (such as python) is selected, or activating on command, workspace contains etc.

I’d like to know what other peoples opinions are on this.

[1] - https://github.com/JPinkney/che-theia/commits/workspace_roots_che

Read more comments on GitHub >

github_iconTop Results From Across the Web

[che-dev] Languages and Tools update - Eclipse
Hello. Regarding blocker [1] (Java LS "Classpath is incomplete" warning when loading petclinic) We need 2d more to check if fix really works....
Read more >
Java Classpath is incomplete. Only syntax errors will be reported
Unfortunately, every time I open the folder that contains the script, I get the following error message: Warn: Classpath is incomplete. Only ...
Read more >
Spring Boot Reference Documentation
Java does not provide a standard way to load nested jar files (jar files that ... This is typically manifested by a warning...
Read more >
9 Oracle WebLogic Server
java File". Section 9.11.3, "Warning Message Appears When Starting Medrec or Samples Domain". 9.11.1 Security Configuration ...
Read more >
redhat-developer/vscode-java - Gitter
@Eugenii10 The code is there https://github.com/eclipse/eclipse.jdt.ls/blob/ ... The Classpath is Incomplete warning is really nice, but it doesn't identify ...
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