Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java Model Exception: Java Model Status [<parent POM project name here> does not exist] #2093

Closed
tigerinus opened this issue Sep 2, 2021 · 7 comments

Comments

@tigerinus
Copy link

tigerinus commented Sep 2, 2021

[provide a description of the issue]

Environment
  • JDK version: GraalVM-8 for project, GraalVM-11 for JDT extension.
  • Java Language Server extension version: 0.81.0
  • Extension Pack for Java version: 0.18.4
  • Visual Studio Code version:
Version: 1.60.0 (system setup)
Commit: e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
Date: 2021-09-01T10:41:52.311Z
Electron: 13.1.8
Chrome: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.19043
  • This is running on a SSH remote environment - not sure if it happens locally or not since we don't have such setup.

  • Remote OS: Oracle Linux 8.

  • Java related settings in VSCode (remote):

    "java.completion.guessMethodArguments": true,
    "java.configuration.runtimes": [
        {
            "name": "JavaSE-1.8",
            "path": "/home/opc/.local/jdk",
            "default": true
        }
    ],
    "java.debug.settings.console": "internalConsole",
    "java.dependency.packagePresentation": "hierarchical",
    "java.dependency.showMembers": true,
    "java.home": "/home/opc/.local/graalvm-ce-java11",
    "java.implementationsCodeLens.enabled": true,
    "java.project.referencedLibraries": [
        "**/target/**/*.class",
        "/home/opc/.ivy2/cache/**/*.jar",
        "/home/opc/.m2/repository/**/*.jar"
    ],
    "java.referencesCodeLens.enabled": true,
Steps To Reproduce
  1. Have a parant POM project whose pom.xml looks like:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.example</groupId>
	<artifactId>parent-example</artifactId>
	<version>0.1.6</version>
	<packaging>pom</packaging>
	<modules>
		<module>common</module>
		<module>service1</module>
		<module>service2</module>
                <module>service3</module>
	</modules>
</project>

where

  • common is a non-Spring simple Maven project;
  • service* are all Spring projects.
  1. in of the the service* project, hold [Ctrl] and click on a class name.
Current Result

The editor keeps thinking for about 1~2 minutes, then write following message 10x times in the output:

[Error - 9:13:06 PM] Sep 2, 2021, 9:13:06 PM Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
parent-example does not exist
Java Model Exception: Java Model Status [parent-example does not exist]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:574)
	at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(JavaModelManager.java:2503)
	at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(JavaProject.java:2382)
	at org.eclipse.jdt.internal.core.JavaProject.getRawClasspath(JavaProject.java:2425)
	at org.eclipse.jdt.launching.JavaRuntime.getVMInstall(JavaRuntime.java:418)
	at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand.getProjectSettings(ProjectCommand.java:96)
	at org.eclipse.jdt.ls.core.internal.JDTDelegateCommandHandler.executeCommand(JDTDelegateCommandHandler.java:78)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:215)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
	at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:205)
	at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:505)
	at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:75)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:642)
	at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:479)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Expected Result

It should just jump the the class definition being clicked.

Additional Informations

This happens intermittently. Sometime it works, sometime it doesn't.

When it doesn't work, even cleaning Java workspace doesn't help.

Sometime it doesn't work right after cleaning Java workspace for other reasons.

There is no clear pattern on how this happens. It's hard to capture the exact steps.

@Eskibear
Copy link
Contributor

Eskibear commented Sep 3, 2021

Java Model Exception: Java Model Status [parent-example does not exist]

I've seen similar error, usually related to parent projects without any java files. It's possible that we didn't cover the case well, but at a first glance I don't obvious connection with the action "jump to definition".

at org.eclipse.jdt.ls.core.internal.commands.ProjectCommand.getProjectSettings(ProjectCommand.java:96)
at org.eclipse.jdt.ls.core.internal.JDTDelegateCommandHandler.executeCommand(JDTDelegateCommandHandler.java:78)

looks like it's called by below delegate command java.project.getSettings as below:

https://github.com/eclipse/eclipse.jdt.ls/blob/9f5ef42b44c229d46372014048f3d427cdaeb08a/org.eclipse.jdt.ls.core/src/org/eclipse/jdt/ls/core/internal/JDTDelegateCommandHandler.java#L77-L78

@jdneo can you take a look where do you call this command, and does it handle parent pom project (possibly without java nature) well?

@testforstephen
Copy link
Collaborator

@tigerinus Would you share the entire server log?

F1 -> Java: Open Java Language Server Log File

Also it helps if you could share .project/.classpath files, which is in the same directory as your pom.xml.

@testforstephen testforstephen self-assigned this Sep 3, 2021
@jdneo
Copy link
Collaborator

jdneo commented Sep 3, 2021

@jdneo can you take a look where do you call this command, and does it handle parent pom project (possibly without java nature) well?

Looks like these are two different problems. The error Java Model Status [parent-example does not exist] will be fixed by eclipse-jdtls/eclipse.jdt.ls#1865. While It might not be relevant with the GTD not working issue.

@tigerinus
Copy link
Author

@tigerinus Would you share the entire server log?

F1 -> Java: Open Java Language Server Log File

Also it helps if you could share .project/.classpath files, which is in the same directory as your pom.xml.

How can I share it in a confidential way? Sharing company server log in public is against our policy.

@testforstephen
Copy link
Collaborator

The "Java Model Exception" has been fixed by PR eclipse-jdtls/eclipse.jdt.ls#1865. It will be included in next version of vscode-java extension. You can also try the CI build to verify it. If Go-To-Definition issue still persists, we need more information to find the root cause.

@jdneo
Copy link
Collaborator

jdneo commented Sep 28, 2021

@tigerinus is the problem fixed?

@tigerinus
Copy link
Author

@tigerinus is the problem fixed?

I haven't seen the issue happening recently. I guess we can close this one for now. I will report again if it still happens.

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

No branches or pull requests

4 participants