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: Error in Java Model (code 969): src/main/.... [in app] does not exist #3181

Open
mikehaertl opened this issue Jun 10, 2024 · 14 comments

Comments

@mikehaertl
Copy link

mikehaertl commented Jun 10, 2024

I try to work on a foreign Android project in neovim + nvim-jdtls and get unexpected errors in this form when eclipse.jdt.ls starts:

Java Model Exception: Error in Java Model (code 969): src/main/java/com/xxxxxlog/app/domain/ihm [in app] does not exist

But that path exists and contains class files.

Full log output:

!SESSION 2024-06-10 14:22:56.108 -----------------------------------------------
eclipse.buildId=unknown
java.version=21.0.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data /home/mike/.local/share/nvim/jdtls_data/xxxxxapp

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:57.682
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:57.880
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:57.902
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:57.903
!MESSAGE Initializing Java Language Server 1.35.0.202404251256

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:57.904
!MESSAGE Started org.eclipse.m2e.core 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.659
!MESSAGE ProjectRegistryRefreshJob finished 755ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.682
!MESSAGE Started org.eclipse.buildship.core 22ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.701
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.701
!MESSAGE Non-Static Commands: [java.project.import, java.project.changeImportedProjects, java.navigate.openTypeHierarchy, java.project.resolveStackTraceLocation, java.edit.handlePasteEvent, java.edit.stringFormatting, java.project.getSettings, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.vm.getAllInstalls, java.edit.organizeImports, java.project.refreshDiagnostics, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.project.resolveText, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.smartSemicolonDetection, java.project.updateSourceAttachment, java.project.updateClassPaths, java.decompile, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.updateJdk, java.project.addToSourcePath, java.completion.onDidSelect]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.702
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.702
!MESSAGE Non-Static Commands: [vscode.java.checkProjectSettings, vscode.java.isOnClasspath, vscode.java.fetchUsageData, vscode.java.validateLaunchConfig, vscode.java.resolveInlineVariables, vscode.java.resolveClassFilters, vscode.java.resolveMainMethod, vscode.java.resolveClasspath, vscode.java.resolveBuildFiles, vscode.java.resolveMainClass, vscode.java.updateDebugSettings, vscode.java.resolveSourceUri, vscode.java.fetchPlatformSettings, vscode.java.buildWorkspace, vscode.java.startDebugSession, vscode.java.inferLaunchCommandLength, vscode.java.resolveElementAtSelection, vscode.java.resolveJavaExecutable]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.703
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.703
!MESSAGE Non-Static Commands: [vscode.java.test.findJavaProjects, vscode.java.test.findTestPackagesAndTypes, vscode.java.test.findTestTypesAndMethods, vscode.java.test.resolvePath, vscode.java.test.findTestLocation, vscode.java.test.get.testpath, vscode.java.test.findDirectTestChildrenForClass, vscode.java.test.navigateToTestOrTarget, vscode.java.test.junit.argument, vscode.java.test.generateTests]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.718
!MESSAGE RepositoryRegistryUpdateJob finished 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.721
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.727
!MESSAGE Creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:58.823
!MESSAGE Finished creating the Java project jdt.ls-java-project

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:22:59.342
!MESSAGE Importing Gradle project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:00.003
!MESSAGE No previous Gradle project at /home/repos/xxxxxlog/ihm/ihm-app/xxxxxapp, it must be synchronized

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.402
!MESSAGE Workspace initialized in 9684ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.424
!MESSAGE >> initialization job finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.428
!MESSAGE >> registerWatchers'

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.488
!MESSAGE Setting /home/mike/.sdkman/candidates/java/8.0.412-amzn as 'JavaSE-1.8' environment (id:/home/mike/.sdkman/candidates/java/8.0.412-amzn)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.491
!MESSAGE Setting /home/mike/.sdkman/candidates/java/21.0.1-tem as 'JavaSE-21' environment (id:1718022178792)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.494
!MESSAGE Setting /home/mike/.sdkman/candidates/java/20.0.1-tem as 'JavaSE-20' environment (id:/home/mike/.sdkman/candidates/java/20.0.1-tem)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.496
!MESSAGE Setting /usr/lib/jvm/java-11-openjdk-amd64 as 'JavaSE-11' environment (id:/usr/lib/jvm/java-11-openjdk-amd64)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.498
!MESSAGE Setting /home/mike/.sdkman/candidates/java/17.0.6-tem as 'JavaSE-17' environment (id:/home/mike/.sdkman/candidates/java/17.0.6-tem)

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-10 14:23:08.508
!MESSAGE Cannot download Gradle sha256 checksum: https://services.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-wrapper.jar.sha256
!STACK 0
java.io.FileNotFoundException: https://downloads.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-wrapper.jar.sha256
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1994)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
	at org.eclipse.jdt.ls.internal.gradle.checksums.DownloadChecksumJob.run(DownloadChecksumJob.java:77)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:08.859
!MESSAGE JVM Runtimes changed, saving new configuration

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-10 14:23:09.646
!MESSAGE Command _java.reloadBundles.command not supported on client

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.081
!MESSAGE Reconciled 1. Took 1 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.893
!MESSAGE begin problem for /IhmProjectAggregate.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.900
!MESSAGE TODO: code-duplication with server code... move into xxxxxlib? is of type Task

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.900
!MESSAGE FIXME: this method should return Single<...> instead of blockingGet the check! is of type Task

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.901
!MESSAGE FIXME: this method should be async, too - instead of blockingGet the check! is of type Task

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.901
!MESSAGE TODO: maybe add support for authorized read here! is of type Task

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.902
!MESSAGE TODO: maybe add support for authorized read here! is of type Task

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.905
!MESSAGE 6 problems reported for /IhmProjectAggregate.java

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-10 14:23:10.906
!MESSAGE src/main/java/com/xxxxxlog/app/domain/ihm [in app] does not exist
!STACK 1
Java Model Exception: Error in Java Model (code 969): src/main/java/com/xxxxxlog/app/domain/ihm [in app] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:562)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:764)
	at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:430)
	at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:328)
	at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:975)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.collectNonJavaProblems(BaseDiagnosticsHandler.java:149)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.endReporting(BaseDiagnosticsHandler.java:135)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.reportProblems(ReconcileWorkingCopyOperation.java:141)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:110)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:805)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1311)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:332)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:295)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$PublishDiagnosticJob.run(BaseDocumentLifeCycleHandler.java:777)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 2024-06-10 14:23:10.907
!MESSAGE src/main/java/com/xxxxxlog/app/domain/ihm [in app] does not exist

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:10.910
!MESSAGE Validated 1. Took 178 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:11.693
!MESSAGE >> build jobs finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-10 14:23:11.704
!MESSAGE >> registerWatchers'

Sidenote: That other error (Cannot download Gradle sha256 checksum) seems to not be a problem. I also have it on another project but the LSP features work fine there. I just don't get why it tries to fetch the checksum for gradle 8.9 because the project uses gradle 8.6. There's no 8.9 configured anywhere.

@mikehaertl
Copy link
Author

Related to / potential duplicate of #3046?

@rgrunber Different to your issue I'm able to reproduce this error everytime. Is there anything else I can provide to help fixing the problem?

@mikehaertl mikehaertl changed the title Cannot download Gradle sha256 checksum error on android project Java Model Exception: Error in Java Model (code 969): src/main/.... [in app] does not exist Jun 10, 2024
@rgrunber
Copy link
Contributor

It's probably a separate issue from #3046. Java model errors are a general type of error.

Are you able to share your project ? Do you know what version of JDT-LS is being used with the client ?

@mikehaertl
Copy link
Author

Unfortunately it's a private code base.

jdtls is v1.35.0.

@rgrunber
Copy link
Contributor

rgrunber commented Jun 10, 2024

I think you're running a nightly version of JDT-LS. The version of gradle referenced is gradle-8.9-20240607003743+0000, which seems like it was built 2024-06-07, which we couldn't have shipped with our End of April release.

https://www.eclipse.org/downloads/download.php?file=/jdtls/snapshots/jdt-language-server-1.37.0-202406071833.tar.gz does contain the following metadata in the language server under gradle/checksums/versions.json :

{
  "version" : "8.9-20240607003743+0000",
  "buildTime" : "20240607003743+0000",
  "current" : false,
  "snapshot" : true,
  "nightly" : true,
  "releaseNightly" : false,
  "activeRc" : false,
  "rcFor" : "",
  "milestoneFor" : "",
  "broken" : false,
  "downloadUrl" : "https://services.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-bin.zip",
  "checksumUrl" : "https://services.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-bin.zip.sha256",
  "wrapperChecksumUrl" : "https://services.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-wrapper.jar.sha256"
}

I'm not sure why it attempted to fetch that instead of using the wrapper that's listed in the project, but it could be an issue in validating the gradle wrapper. We do check that the version of Gradle listed matches exactly the checksum of the proper released version.

It might be worth trying JDT-LS 1.36 or something else just to see if that works.

@mikehaertl
Copy link
Author

That's weird. I've installed jdtls via mason-nvim. It clearly references the 1.35 download as can be seen in it's registry file here:

https://github.com/mason-org/mason-registry/blob/8ae81b2226c0ebe27fcf433397ebd7ecca24aa9c/packages/jdtls/package.yaml

@rgrunber
Copy link
Contributor

Have a look from #2898 (comment) and below . Very similar issue. I had the user report the output of jps -lv to confirm the version and it wasn't what they expected.

@mikehaertl
Copy link
Author

Here's the output of jps -lv. Note that I work on several Java projects in parallel each with different gradle versions.

640632 org.gradle.launcher.daemon.bootstrap.GradleDaemon -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx4096m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -javaagent:/home/mike/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/agents/gradle-instrumentation-agent-8.6.jar
267984 org.gradle.launcher.daemon.bootstrap.GradleDaemon --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -javaagent:/home/mike/.gradle/wrapper/dists/gradle-8.4-bin/1w5dpkrfk8irigvoxmyhowfim/gradle-8.4/lib/agents/gradle-instrumentation-agent-8.4.jar
641004 org.jetbrains.kotlin.daemon.KotlinCompileDaemon -Djava.awt.headless=true -D$java.rmi.server.hostname=127.0.0.1 -Xmx4096m -XX:MaxMetaspaceSize=1024m -Dkotlin.environment.keepalive -ea --add-exports=java.base/sun.nio.ch=ALL-UNNAMED
847866 org.gradle.launcher.daemon.bootstrap.GradleDaemon --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -XX:MaxMetaspaceSize=384m -XX:+HeapDumpOnOutOfMemoryError -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -javaagent:/home/mike/.gradle/wrapper/dists/gradle-8.2.1-bin/5hap6b9n41hkg4jeh2au2pllh/gradle-8.2.1/lib/agents/gradle-instrumentation-agent-8.2.1.jar
875045 jdk.jcmd/sun.tools.jps.Jps -Dapplication.home=/home/mike/.sdkman/candidates/java/17.0.6-tem -Xms8m -Djdk.module.main=jdk.jcmd
628560 /home/mike/.local/share/nvim/mason/packages/jdtls/plugins/org.eclipse.equinox.launcher_1.6.800.v20240330-1250.jar -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true -Dlog.level=ALL -Xmx1g --add-modules=ALL-SYSTEM --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED -javaagent:/home/repos/github/lombok/dist/lombok.jar
788834 org.gradle.launcher.daemon.bootstrap.GradleDaemon -XX:MaxMetaspaceSize=1024m -XX:+HeapDumpOnOutOfMemoryError --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED -Xmx4096m -Dfile.encoding=UTF-8 -Duser.country=US -Duser.language=en -Duser.variant -javaagent:/home/mike/.gradle/wrapper/dists/gradle-8.6-bin/afr5mpiioh2wthjmwnkmdsd5w/gradle-8.6/lib/agents/gradle-instrumentation-agent-8.6.jar

@mikehaertl
Copy link
Author

I've now also tried with 1.36 and still get the same errors:

!SESSION 2024-06-11 19:22:43.805 -----------------------------------------------
eclipse.buildId=unknown
java.version=21.0.1
java.vendor=Eclipse Adoptium
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_US
Command-line arguments:  -data /home/mike/.local/share/nvim/jdtls_data/xxxxxxapp

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:45.289
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:45.455
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:45.480
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:45.482
!MESSAGE Initializing Java Language Server 1.36.0.202405301306

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:45.483
!MESSAGE Started org.eclipse.m2e.core 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.215
!MESSAGE ProjectRegistryRefreshJob finished 731ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.236
!MESSAGE Started org.eclipse.buildship.core 20ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.256
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.257
!MESSAGE Non-Static Commands: [java.project.import, java.project.changeImportedProjects, java.navigate.openTypeHierarchy, java.project.resolveStackTraceLocation, java.edit.handlePasteEvent, java.edit.stringFormatting, java.project.getSettings, java.project.resolveWorkspaceSymbol, java.project.upgradeGradle, java.project.createModuleInfo, java.vm.getAllInstalls, java.edit.organizeImports, java.project.refreshDiagnostics, java.project.removeFromSourcePath, java.project.listSourcePaths, java.project.updateSettings, java.project.getAll, java.reloadBundles, java.project.isTestFile, java.project.resolveText, java.project.getClasspaths, java.navigate.resolveTypeHierarchy, java.edit.smartSemicolonDetection, java.project.updateSourceAttachment, java.project.updateClassPaths, java.decompile, java.protobuf.generateSources, java.project.resolveSourceAttachment, java.project.updateJdk, java.project.addToSourcePath, java.completion.onDidSelect]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.258
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.258
!MESSAGE Non-Static Commands: [vscode.java.test.findJavaProjects, vscode.java.test.findTestPackagesAndTypes, vscode.java.test.findTestTypesAndMethods, vscode.java.test.resolvePath, vscode.java.test.findTestLocation, vscode.java.test.get.testpath, vscode.java.test.findDirectTestChildrenForClass, vscode.java.test.navigateToTestOrTarget, vscode.java.test.junit.argument, vscode.java.test.generateTests]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.259
!MESSAGE Static Commands: []

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.259
!MESSAGE Non-Static Commands: [vscode.java.checkProjectSettings, vscode.java.isOnClasspath, vscode.java.fetchUsageData, vscode.java.validateLaunchConfig, vscode.java.resolveInlineVariables, vscode.java.resolveClassFilters, vscode.java.resolveMainMethod, vscode.java.resolveClasspath, vscode.java.resolveBuildFiles, vscode.java.resolveMainClass, vscode.java.updateDebugSettings, vscode.java.resolveSourceUri, vscode.java.fetchPlatformSettings, vscode.java.buildWorkspace, vscode.java.startDebugSession, vscode.java.inferLaunchCommandLength, vscode.java.resolveElementAtSelection, vscode.java.resolveJavaExecutable]

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.276
!MESSAGE RepositoryRegistryUpdateJob finished 0ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.284
!MESSAGE >> initialized

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:46.299
!MESSAGE Importing Gradle project(s)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:47.030
!MESSAGE No previous Gradle project at /home/repos/xxxxxxlog/ihm/ihm-app/xxxxxxapp, it must be synchronized

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-11 19:22:53.699
!MESSAGE Cannot download Gradle sha256 checksum: https://services.gradle.org/distributions-snapshots/gradle-8.9-20240610151718+0000-wrapper.jar.sha256
!STACK 0
java.io.FileNotFoundException: https://downloads.gradle.org/distributions-snapshots/gradle-8.9-20240610151718+0000-wrapper.jar.sha256
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1994)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
	at org.eclipse.jdt.ls.internal.gradle.checksums.DownloadChecksumJob.run(DownloadChecksumJob.java:77)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:53.759
!MESSAGE Workspace initialized in 7483ms

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-11 19:22:53.858
!MESSAGE Cannot download Gradle sha256 checksum: https://services.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-wrapper.jar.sha256
!STACK 0
java.io.FileNotFoundException: https://downloads.gradle.org/distributions-snapshots/gradle-8.9-20240607003743+0000-wrapper.jar.sha256
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1994)
	at java.base/sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599)
	at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223)
	at org.eclipse.jdt.ls.internal.gradle.checksums.DownloadChecksumJob.run(DownloadChecksumJob.java:77)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:53.919
!MESSAGE >> initialization job finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:53.995
!MESSAGE Setting /home/mike/.sdkman/candidates/java/8.0.412-amzn as 'JavaSE-1.8' environment (id:/home/mike/.sdkman/candidates/java/8.0.412-amzn)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:53.996
!MESSAGE Setting /home/mike/.sdkman/candidates/java/21.0.1-tem as 'JavaSE-21' environment (id:1718126566312)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:53.998
!MESSAGE Setting /home/mike/.sdkman/candidates/java/20.0.1-tem as 'JavaSE-20' environment (id:/home/mike/.sdkman/candidates/java/20.0.1-tem)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:54.004
!MESSAGE Setting /usr/lib/jvm/java-11-openjdk-amd64 as 'JavaSE-11' environment (id:/usr/lib/jvm/java-11-openjdk-amd64)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:54.009
!MESSAGE Setting /home/mike/.sdkman/candidates/java/17.0.6-tem as 'JavaSE-17' environment (id:/home/mike/.sdkman/candidates/java/17.0.6-tem)

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:54.377
!MESSAGE JVM Runtimes changed, saving new configuration

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-11 19:22:55.186
!MESSAGE Command _java.reloadBundles.command not supported on client

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:55.634
!MESSAGE Reconciled 1. Took 1 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:56.362
!MESSAGE begin problem for /AddResultActivity.java

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:56.366
!MESSAGE 1 problems reported for /AddResultActivity.java

!ENTRY org.eclipse.jdt.ls.core 4 0 2024-06-11 19:22:56.368
!MESSAGE src/main/java/com/xxxxxxlog/app/ui/screens/ihm/addresult [in app] does not exist
!STACK 1
Java Model Exception: Error in Java Model (code 969): src/main/java/com/xxxxxxlog/app/ui/screens/ihm/addresult [in app] does not exist
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:562)
	at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource(PackageFragmentRoot.java:764)
	at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource(PackageFragment.java:430)
	at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource(Openable.java:328)
	at org.eclipse.jdt.internal.core.CompilationUnit.getUnderlyingResource(CompilationUnit.java:975)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.collectNonJavaProblems(BaseDiagnosticsHandler.java:149)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDiagnosticsHandler.endReporting(BaseDiagnosticsHandler.java:135)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.reportProblems(ReconcileWorkingCopyOperation.java:141)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:110)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:805)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1311)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:332)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler.publishDiagnostics(BaseDocumentLifeCycleHandler.java:295)
	at org.eclipse.jdt.ls.core.internal.handlers.BaseDocumentLifeCycleHandler$PublishDiagnosticJob.run(BaseDocumentLifeCycleHandler.java:777)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
!SUBENTRY 1 org.eclipse.jdt.core 4 969 2024-06-11 19:22:56.368
!MESSAGE src/main/java/com/xxxxxxlog/app/ui/screens/ihm/addresult [in app] does not exist

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:56.372
!MESSAGE Validated 1. Took 86 ms

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:57.828
!MESSAGE >> build jobs finished

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:57.829
!MESSAGE >> registerWatchers'

!ENTRY org.eclipse.jdt.ls.core 1 0 2024-06-11 19:22:57.839
!MESSAGE >> registerWatchers'

@rgrunber
Copy link
Contributor

Having checked how the checksums are verified, I don't think the download failure is harmful. With that said, could you check for the presence of /home/mike/.cache/tooling/gradle/ and remove the contents of that directory. It should just include a checksums/ folder and a versions.json file. Then try to re-import the project and see if you still get that Gradle error.

@mikehaertl
Copy link
Author

I removed the content from that directory and now the gradle error is really gone, thanks.

But the main problem is still there:

Java Model Exception: Error in Java Model (code 969): src/main/java/com/xxxxxxlog/app/ui/screens/ihm/addresult [in app] does not exist

@archer-n
Copy link

I have the same problem and can reproduce this issue using https://github.com/eclipse-jdtls/eclipse.jdt.ls/tree/master/org.eclipse.jdt.ls.tests/projects/gradle/android

My environment:

jdtls: jdt-language-server-1.37.0-202406130424.tar.gz
jdk: openjdk 17.0.11 2024-04-16

Here is my initialization configuration:

{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"processId":22897,"clientInfo":{"name":"Eglot","version":"1.17"},"rootPath":"/home/archer/workspace/test/android/","rootUri":"file:///home/archer/workspace/test/android","initializationOptions":{"settings":{"java.jdt.ls.androidSupport.enabled":true,"java.imports.gradle.wrapper.checksums":[{"sha256":"504b38a11c466aecb2f5c0b0d8ce0ed7ffa810bf70b9b7a599c570051be8fb4e","allowed":true}]},"extendedClientCapabilities":{"classFileContentsSupport":true}},"capabilities":{"workspace":{"applyEdit":true,"executeCommand":{"dynamicRegistration":false},"workspaceEdit":{"documentChanges":true},"didChangeWatchedFiles":{"dynamicRegistration":true},"symbol":{"dynamicRegistration":false},"configuration":true,"workspaceFolders":true},"textDocument":{"synchronization":{"dynamicRegistration":false,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":false,"completionItem":{"snippetSupport":true,"deprecatedSupport":true,"resolveSupport":{"properties":["documentation","details","additionalTextEdits"]},"tagSupport":{"valueSet":[1]}},"contextSupport":true},"hover":{"dynamicRegistration":false,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":false,"signatureInformation":{"parameterInformation":{"labelOffsetSupport":true},"documentationFormat":["markdown","plaintext"],"activeParameterSupport":true}},"references":{"dynamicRegistration":false},"definition":{"dynamicRegistration":false,"linkSupport":true},"declaration":{"dynamicRegistration":false,"linkSupport":true},"implementation":{"dynamicRegistration":false,"linkSupport":true},"typeDefinition":{"dynamicRegistration":false,"linkSupport":true},"documentSymbol":{"dynamicRegistration":false,"hierarchicalDocumentSymbolSupport":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]}},"documentHighlight":{"dynamicRegistration":false},"codeAction":{"dynamicRegistration":false,"resolveSupport":{"properties":["edit","command"]},"dataSupport":true,"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"isPreferredSupport":true},"formatting":{"dynamicRegistration":false},"rangeFormatting":{"dynamicRegistration":false},"rename":{"dynamicRegistration":false},"inlayHint":{"dynamicRegistration":false},"publishDiagnostics":{"relatedInformation":false,"codeDescriptionSupport":false,"tagSupport":{"valueSet":[1,2]}}},"window":{"showDocument":{"support":true},"workDoneProgress":true},"general":{"positionEncodings":["utf-32","utf-8","utf-16"]},"experimental":{}},"workspaceFolders":[{"uri":"file:///home/archer/workspace/test/android","name":"~/workspace/test/android/"}]}}

@jdneo
Copy link
Contributor

jdneo commented Aug 29, 2024

Have you set java.jdt.ls.androidSupport.enabled to on?

@mikehaertl
Copy link
Author

I've added that setting now but no difference. Still see that exception in jdt.ls logs and the LSP does not work properly.

@mikehaertl
Copy link
Author

I had similar errors in other (non-android) projects (... is not on the classpath ...). I found that buildWorkspace (:JdtlsCompile in nvim-jdtls) fixed it there. Looking at .classpath it makes sense. That file references the bin/ directory:

<classpathentry kind="output" path="bin/default"/>

Calling buildWorkspace actually populated the bin/ directory in the other project. Not sure why this had to be triggered manually, though.

So I tried the same for this android project. The buildWorkspace command reports success but there is no bin/ directory created.

So the error remains.

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

No branches or pull requests

4 participants