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

NoSuchMethodError on JavaProject.internalDefaultRootModules and Project Load issue in Multi-module Gradle Spring App #3986

Closed
ramazangirgin-check24 opened this issue Mar 24, 2025 · 8 comments

Comments

@ramazangirgin-check24
Copy link

ramazangirgin-check24 commented Mar 24, 2025

Hi,
We have a multi-module Gradle-based Java Spring application. When trying to open it in Cursor IDE with the Language Support for Java plugin enabled, the project does not fully load and takes a long time to partially initialize.

We observed the following error in the logs:

Mar 24, 2025 2:33:27 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider ch.qos.logback.classic.servlet.LogbackServletContainerInitializer of service jakarta.servlet.ServletContainerInitializer in bundle ch.qos.logback.classic
Mar 24, 2025 2:33:27 PM org.apache.aries.spifly.BaseActivator log
INFO: Registered provider ch.qos.logback.classic.spi.LogbackServiceProvider of service org.slf4j.spi.SLF4JServiceProvider in bundle ch.qos.logback.classic
[Error - 14:37:58] 24 Mar 2025, 14:37:58 Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".
'java.util.List org.eclipse.jdt.internal.core.JavaProject.internalDefaultRootModules(java.lang.Iterable, java.util.function.Function, java.util.function.Function)'
java.lang.NoSuchMethodError: 'java.util.List org.eclipse.jdt.internal.core.JavaProject.internalDefaultRootModules(java.lang.Iterable, java.util.function.Function, java.util.function.Function)'
    at com.microsoft.java.builder.jdtbuilder.ClasspathJrt.selectModules(ClasspathJrt.java:278)
    at com.microsoft.java.builder.jdtbuilder.ClasspathJrt.getModuleNames(ClasspathJrt.java:265)
    at com.microsoft.java.builder.jdtbuilder.NameEnvironment.collectModuleEntries(NameEnvironment.java:445)
    at com.microsoft.java.builder.jdtbuilder.NameEnvironment.computeClasspathLocations(NameEnvironment.java:343)
    at com.microsoft.java.builder.jdtbuilder.NameEnvironment.<init>(NameEnvironment.java:64)
    at com.microsoft.java.builder.JavaNameEnvironment.<init>(JavaNameEnvironment.java:41)
    at com.microsoft.java.builder.JavaProblemChecker.createNameEnvironment(JavaProblemChecker.java:51)
    at com.microsoft.java.builder.jdtbuilder.JavaBuilder.initializeBuilder(JavaBuilder.java:653)
    at com.microsoft.java.builder.jdtbuilder.JavaBuilder.build(JavaBuilder.java:192)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1077)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:296)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:352)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:441)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:444)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:555)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:503)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:585)
    at org.eclipse.core.internal.events.AutoBuildJob.doBuild(AutoBuildJob.java:207)
    at org.eclipse.core.internal.events.AutoBuildJob.run(AutoBuildJob.java:300)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

Our project uses a bit sophisticated module naming pattern similar to ::[:]

Last part of the module ( subtype/type ) can be same for multiple modules like api or impl.

foo:module1:api
foo:module1:impl
foo:module2:api
foo:module2:impl
...
...

The plugin seems to struggle with resolving modules and reports cyclical dependencies, although our setup doesn't have actual circular dependencies.

Image Image

We don't have any cyclic dependecy issues with our project. Our project works perfectly fine while working with IntelliJ IDEA or building / running it with gradle from command line.

We use the following versions:

  • Gradle: 8.12.1
  • Java: OpenJDK 21.0.3 LTS
  • Spring Boot: 3.4.3
  • Cursor Version: 0.47.8 (Universal)
  • Language Support for Java(TM) by Red Hat plugin Version 1.40.0

Do you have any idea why we are facing with weird errors and loading issue ? We want to switch to Cursor IDE and the current problem is blocker for us.
It would be good if you can guide us in any someway for finding a solution for it.

Thanks in advance
Ramazan

@rgrunber
Copy link
Member

A duplicate of eclipse-jdtls/eclipse.jdt.ls#3401 . This is an issue with vscode-gradle. See microsoft/vscode-gradle#1651 .

@ramazangirgin-check24
Copy link
Author

@rgrunber thanks for the update.
are the "resolving modules and reports cyclic dependencies" issues (see screenshots) also related to the microsoft/vscode-gradle#1651 issue?

So should we expect these to be resolved then the vscode-gradle issue to be resolved as well?

@rgrunber
Copy link
Member

You could try reverting to vscode-java 1.39.0, which should avoid the NoSuchMethodError. If the cyclic dependency is also not present afterwards, it's likely the issue is related and will go away once that is also fixed. I do see code in the VS Code gradle build server extension that deals with cycles.

@ramazangirgin-check24
Copy link
Author

I reverted to vscode-java 1.39.0, no "NoSuchMethodError on JavaProject.internalDefaultRootModules" error anymore but still "resolving modules and reports cyclic dependencies" issues are there.
So, it seems downgrading doesn't help and probably it is another issue.
Should i create a new issue only for "resolving modules and reports cyclic dependencies" ?

@ramazangirgin-check24
Copy link
Author

@rgrunber any comment for creating the new issue for "resolving modules and reports cyclic dependencies" errors ?

@rgrunber
Copy link
Member

rgrunber commented Mar 26, 2025

Can you confirm that java.gradle.buildServer.enabled is set to on ? It would have to be based on the original stacktrace.

You could try setting it to off temporarily, re-import the project and see if anything changes.

I know that there are limitations around cyclic dependencies in Buildship (the Gradle builder used when vscode-gradle isn't installed) but this looks like it would be generated by vscode-gradle so eclipse-buildship/buildship#460 shouldn't be the problem. Maybe similar to microsoft/vscode-gradle#1154 ?

I would file a new bug here if you can see the issue with java.gradle.buildServer.enabled off and at https://github.com/microsoft/vscode-gradle/ if you can only see the issue with that same setting on.

@ramazangirgin-check24
Copy link
Author

@rgrunber yes, java.gradle.buildServer.enabled was set to on. I update is as off but it doesn't work for me, i see the following error logged.

[Error - 15:11:26] 26 Mar 2025, 15:11:26 Error checking whether PackageFragmentRoot is on module path!
[in model-xxx-api] is not on its project's build path
Java Model Exception: Error in Java Model (code 1006): [in model-xxx-api] is not on its project's build path
at org.eclipse.jdt.internal.core.PackageFragmentRoot.getRawClasspathEntry(PackageFragmentRoot.java:622)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.computeModuleFor(JavaSearchNameEnvironment.java:610)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.mapToClassPathLocation(JavaSearchNameEnvironment.java:302)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.computeClasspathLocations(JavaSearchNameEnvironment.java:215)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.computeClasspathLocations(JavaSearchNameEnvironment.java:187)
at org.eclipse.jdt.internal.core.search.matching.JavaSearchNameEnvironment.(JavaSearchNameEnvironment.java:95)
at org.eclipse.jdt.internal.core.search.indexing.SourceIndexer.resolveDocument(SourceIndexer.java:180)
at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.resolveDocument(JavaSearchParticipant.java:125)
at org.eclipse.jdt.internal.core.search.indexing.IndexManager.indexResolvedDocument(IndexManager.java:668)
at org.eclipse.jdt.internal.core.search.indexing.IndexManager$2.execute(IndexManager.java:1272)
at org.eclipse.jdt.internal.core.search.processing.JobManager.indexerLoop(JobManager.java:541)
at java.base/java.lang.Thread.run(Thread.java:1583)

[Error - 15:11:43] 26 Mar 2025, 15:11:43 Cannot download Gradle sha256 checksum: https://services.gradle.org/distributions-snapshots/gradle-8.4-20230903222207+0000-wrapper.jar.sha256
https://downloads.gradle.org/distributions-snapshots/gradle-8.4-20230903222207+0000-wrapper.jar.sha256
java.io.FileNotFoundException: https://downloads.gradle.org/distributions-snapshots/gradle-8.4-20230903222207+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)

Mar 26, 2025 3:19:57 PM com.microsoft.java.debug.plugin.internal.JavaDebuggerServerPlugin start
INFO: Starting com.microsoft.java.debug.plugin
[Error - 15:19:57] 26 Mar 2025, 15:19:57 Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ls.core".
actuator does not exist
Java Model Exception: Error in Java Model (code 969): actuator does not exist
at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:546)
at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(JavaModelManager.java:2549)
at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(JavaProject.java:2339)
at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:2412)
at org.eclipse.jdt.internal.core.JavaProject.getAllPackageFragmentRoots(JavaProject.java:1784)
at org.eclipse.jdt.internal.core.JavaProject.getAllPackageFragmentRoots(JavaProject.java:1775)
at com.microsoft.jdtls.ext.core.ProjectCommand.getMainClasses(ProjectCommand.java:243)
at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:35)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:610)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)

[Error - 15:19:57] 26 Mar 2025, 15:19:57 Error in calling delegate command handler
actuator does not exist
Java Model Exception: Error in Java Model (code 969): actuator does not exist
at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:546)
at org.eclipse.jdt.internal.core.JavaModelManager.getPerProjectInfoCheckExistence(JavaModelManager.java:2549)
at org.eclipse.jdt.internal.core.JavaProject.getPerProjectInfo(JavaProject.java:2339)
at org.eclipse.jdt.internal.core.JavaProject.getResolvedClasspath(JavaProject.java:2412)
at org.eclipse.jdt.internal.core.JavaProject.getAllPackageFragmentRoots(JavaProject.java:1784)
at org.eclipse.jdt.internal.core.JavaProject.getAllPackageFragmentRoots(JavaProject.java:1775)
at com.microsoft.jdtls.ext.core.ProjectCommand.getMainClasses(ProjectCommand.java:243)
at com.microsoft.jdtls.ext.core.CommandHandler.executeCommand(CommandHandler.java:35)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler$1.run(WorkspaceExecuteCommandHandler.java:230)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
at org.eclipse.jdt.ls.core.internal.handlers.WorkspaceExecuteCommandHandler.executeCommand(WorkspaceExecuteCommandHandler.java:220)
at org.eclipse.jdt.ls.core.internal.handlers.JDTLanguageServer.lambda$4(JDTLanguageServer.java:610)
at org.eclipse.jdt.ls.core.internal.BaseJDTLanguageServer.lambda$0(BaseJDTLanguageServer.java:87)
at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
at java.base/java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483)
at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387)
at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312)
at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843)
at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808)
at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188)


66da2d72 Synchronize Gradle projects with workspace [Done]
3d93bf13 Synchronize Gradle projects with workspace [Done]
e047d4a9 Synchronize Gradle projects with workspace [Done]
2921db0f Synchronize Gradle projects with workspace [Done]
0124736a https://services.gradle.org/distributions-snapshots/gradle-8.3-20230816232259+0000-wrapper.jar.sha256 [Done]
9f8dd1bc Validating Gradle wrapper checksum... [Done]
fc7368f4 Synchronizing Gradle build at /Users/ramazan.girgin/work/git/XXX [Done]
5e47f92c Synchronize Gradle projects with workspace - 50%
ecbe896d Refreshing workspace - 1% Refreshing '/XXX-server'.
f9502f3c Synchronizing projects - 0%

  • we have model-xxx-api in our project ( this error reported for multiple projects )
  • normally we configured our nexus for gradle, it shoudn't connect to gradle.org but it does.

project load time is very very slow ( no success after an hour, still waiting ) but don't see previous reported circular dependencies. I see our sub-projects in java projects view. ( not clickable )

regarding "resolving modules and reports cyclic dependencies", as i mentioned before, we don't have any cyclic dependencies, just it is reported, evaluated wrongly.
Since we also use https://github.com/microsoft/vscode-gradle/, if it is not related to vscode-java, I created an issue in https://github.com/microsoft/vscode-gradle/
please see
microsoft/vscode-gradle#1659

thank you.

@ramazangirgin-check24
Copy link
Author

Update regarding "java.gradle.buildServer.enabled" - off

After ~2hours, it completed the our project import but i see a lot reported errors for our project. It looks like it is related to the issue that it didn't discover dependencies or java classes from the project properly.

So, "java.gradle.buildServer.enabled" - off doesn't work for us for now.

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

2 participants