Closed psybases closed 7 months ago
eclipse.buildId=4.20.1.202310260003 java.version=17.0.8.1 java.vendor=Eclipse Adoptium BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US Framework arguments: -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 Command-line arguments: -os win32 -ws win32 -arch x86_64 -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 -product org.springframework.boot.ide.branding.sts4 -data C:\Development\eclipse-workspace\psyProject -product org.springframework.boot.ide.branding.sts4
org.springframework.tooling.boot.ls Error Tue Nov 14 15:41:03 EET 2023 InvocationTargetException
java.lang.reflect.InvocationTargetException at org.springframework.tooling.boot.ls.commands.RewriteRefactoringsHandler.lambda$7(RewriteRefactoringsHandler.java:148) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122) Caused by: java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) at org.springframework.tooling.boot.ls.commands.RewriteRefactoringsHandler.lambda$7(RewriteRefactoringsHandler.java:146) ... 1 more Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193) at org.eclipse.lsp4e.LanguageServerWrapper.lambda$3(LanguageServerWrapper.java:285) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Root exception: java.util.concurrent.ExecutionException: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396) at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2073) at org.springframework.tooling.boot.ls.commands.RewriteRefactoringsHandler.lambda$7(RewriteRefactoringsHandler.java:146) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122) Caused by: org.eclipse.lsp4j.jsonrpc.ResponseErrorException: Internal error. at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.handleResponse(RemoteEndpoint.java:209) at org.eclipse.lsp4j.jsonrpc.RemoteEndpoint.consume(RemoteEndpoint.java:193) at org.eclipse.lsp4e.LanguageServerWrapper.lambda$3(LanguageServerWrapper.java:285) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.handleMessage(StreamMessageProducer.java:194) at org.eclipse.lsp4j.jsonrpc.json.StreamMessageProducer.listen(StreamMessageProducer.java:94) at org.eclipse.lsp4j.jsonrpc.json.ConcurrentMessageProcessor.run(ConcurrentMessageProcessor.java:113) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)
@psybases We have added more error reporting around project parsing logic in the snapshot builds. There is a chance to find out more info about the parsing issue if you try the latest snapshot build. Do you mind grabbing the latest snapshot distro build or use the nightly update site from this page: https://cdn.spring.io/spring-tools/snapshot/STS4/nightly-distributions.html ? Try upgrading the same project again and check the UI for warning messages and the Spring Boot Language Server Log for errors. Ideally we should get info about the file that failed to parse and hopefully the reason for the parse error. Thus far, it seems that maven pom file parsing issue... XML parsed but the maven specific bits such as dependencies, plugins etc had some kind of error... Is it just one specific project having this issue? If you can share the project or some simplified version of it that exhibits the same issue it'd be great
@BoykoAlex ok thanks, I will try to use the nightly build and provide more info.
@BoykoAlex the only new info that I found while using the snapshot build of STS4 Version: 4.21.0.202311142019-SNAPSHOT Build Id: 202311142019 is the following:
Project Parsing error: org.openrewrite.maven.MavenDownloadingException: org.myorg.myproject:my-services:1.0.0-SNAPSHOT failed. Unable to download POM.
11:21:04.929 [Project-Reconciler-3] INFO o.s.i.v.b.v.BootVersionValidationEngine - validating Spring Boot version on project: my-services-war done in 1ms 11:21:12.352 [ForkJoinPool.commonPool-worker-5] ERROR o.s.i.v.b.j.r.RewriteRecipeRepository - Project Parsing error: org.openrewrite.maven.MavenDownloadingException: org.myorg.myproject:my-services:1.0.0-SNAPSHOT failed. Unable to download POM. at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:595) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentPom(ResolvedPom.java:457) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentPropertiesAndRepositoriesRecursively(ResolvedPom.java:373) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentsRecursively(ResolvedPom.java:328) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolve(ResolvedPom.java:317) at org.openrewrite.maven.tree.ResolvedPom.resolve(ResolvedPom.java:149) at org.openrewrite.maven.tree.Pom.resolve(Pom.java:104) at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:105) at org.springframework.ide.vscode.commons.rewrite.maven.MavenIJavaProjectParser.parseBuildFiles(MavenIJavaProjectParser.java:107) at org.springframework.ide.vscode.commons.rewrite.java.ProjectParser.parse(ProjectParser.java:45) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.computeWorkspaceEdit(RewriteRecipeRepository.java:372) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.lambda$apply$18(RewriteRecipeRepository.java:333) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) 11:21:12.353 [ForkJoinPool.commonPool-worker-5] ERROR o.e.lsp4j.jsonrpc.RemoteEndpoint - Internal error: java.lang.NullPointerException: Cannot invoke "org.openrewrite.maven.tree.ResolvedPom.getValue(String)" because "mavenModel" is null java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "org.openrewrite.maven.tree.ResolvedPom.getValue(String)" because "mavenModel" is null at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1159) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) Caused by: java.lang.NullPointerException: Cannot invoke "org.openrewrite.maven.tree.ResolvedPom.getValue(String)" because "mavenModel" is null at org.springframework.ide.vscode.commons.rewrite.maven.MavenIJavaProjectParser.getJavaProvenance(MavenIJavaProjectParser.java:66) at org.springframework.ide.vscode.commons.rewrite.java.ProjectParser.parseModule(ProjectParser.java:57) at org.springframework.ide.vscode.commons.rewrite.java.ProjectParser.parse(ProjectParser.java:49) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.computeWorkspaceEdit(RewriteRecipeRepository.java:372) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.lambda$apply$18(RewriteRecipeRepository.java:333) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ... 8 common frames omitted
In my project I have the parent pom.xml in the root folder and there another pom.xml inside a subfolder called war
pom.xml:
war/pom.xml
Looks like it fails to find the pom for maven artifact org.myorg.myproject:my-services:1.0.0-SNAPSHOT
. Unfortunately, we don't support multi-module project parsing from the IDE yet. Try running mvn clean install -DskipTests
on the root project or in all parents projects such that they reside in local maven repo and then try upgrading the current project that gives issues in the IDE. Then upgrade the parent projects.
If you like to migrate all related projects in one go then try Moderne CLI. If you go this route i can help you configure the CLI with recipes.
Looks like it fails to find the pom for maven artifact
org.myorg.myproject:my-services:1.0.0-SNAPSHOT
. Unfortunately, we don't support multi-module project parsing from the IDE yet. Try runningmvn clean install -DskipTests
on the root project or in all parents projects such that they reside in local maven repo and then try upgrading the current project that gives issues in the IDE. Then upgrade the parent projects. If you like to migrate all related projects in one go then try Moderne CLI. If you go this route i can help you configure the CLI with recipes.
Hi, unfortunately running clean install didn't help... :( From "where" it tries to download the POM for the artifact? Note that I am using the same maven local .m2 directory for both eclipse and maven from the console. Thanks for the ModerneCLI link I ll give it a try.
Any chance you could attach some kind of sample project to this issue? I've tried something similar to your setup but it worked for me... Did Moderne CLI work for you?
Any chance you could attach some kind of sample project to this issue? I've tried something similar to your setup but it worked for me... Did Moderne CLI work for you?
Hi, unfortunately I cannot share the actual project structure. Could we do it the other way round, and share with me your sample setup to test it? No Moderne CLI didn't work, I was getting an error from the mod command. Eventually I had used the maven plugin from the maven console, but of course it would be nice to have it fully functional from the IDE :)
Lets try with the project below. Seems to parse for me. parent-multi-module.zip
Hi @BoykoAlex , sorry for the late response. Unfortunatelly I am getting the same error when trying to refactor/upgrade:
12:11:41.177 [Project-Reconciler-1] INFO o.s.i.v.b.v.BootVersionValidationEngine - validating Spring Boot version on project: library done in 1ms 12:11:53.263 [ForkJoinPool.commonPool-worker-1] INFO o.s.i.v.b.j.r.RewriteRecipeRepository - Loading Rewrite Recipes... 12:12:08.602 [ForkJoinPool.commonPool-worker-1] INFO o.s.i.v.b.j.r.RewriteRecipeRepository - Done loading Rewrite Recipes 12:13:31.638 [ForkJoinPool.commonPool-worker-2] ERROR o.s.i.v.b.j.r.RewriteRecipeRepository - Project Parsing error: org.openrewrite.maven.MavenDownloadingException: com.baeldung:parent-multi-module:0.0.1-SNAPSHOT failed. Unable to download POM. at org.openrewrite.maven.internal.MavenPomDownloader.download(MavenPomDownloader.java:595) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentPom(ResolvedPom.java:457) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentPropertiesAndRepositoriesRecursively(ResolvedPom.java:373) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolveParentsRecursively(ResolvedPom.java:328) at org.openrewrite.maven.tree.ResolvedPom$Resolver.resolve(ResolvedPom.java:317) at org.openrewrite.maven.tree.ResolvedPom.resolve(ResolvedPom.java:149) at org.openrewrite.maven.tree.Pom.resolve(Pom.java:104) at org.openrewrite.maven.MavenParser.parseInputs(MavenParser.java:105) at org.springframework.ide.vscode.commons.rewrite.maven.MavenIJavaProjectParser.parseBuildFiles(MavenIJavaProjectParser.java:107) at org.springframework.ide.vscode.commons.rewrite.java.ProjectParser.parse(ProjectParser.java:45) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.computeWorkspaceEdit(RewriteRecipeRepository.java:372) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.lambda$apply$18(RewriteRecipeRepository.java:333) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
I am in a corporate environment, so I am starting to think if could be due to internal Nexus Repository Manager?
Did you execute mvn clean install
before importing the sample into STS?
Any chance you can give the same sample a try on a machine not on a corporate network just to double-check?
Perhaps disconnecting from wi-fi or pulling out ethernet cable might do the trick if all maven dependencies are in local maven repo...
Thanks @BoykoAlex , I just tested it on a non-corporate network and it works. Closing.
Describe the bug Using Spring Tool Suite 4 Version: 4.20.1.RELEASE Build Id: 202310260003
Upgrading or Refactoring a Spring Boot maven project fails with NPE:
15:40:12.251 [ForkJoinPool.commonPool-worker-2] INFO o.s.i.v.b.j.r.RewriteRecipeRepository - Loading Rewrite Recipes... 15:40:23.747 [ForkJoinPool.commonPool-worker-2] INFO o.s.i.v.b.j.r.RewriteRecipeRepository - Done loading Rewrite Recipes 15:40:33.432 [ForkJoinPool.commonPool-worker-2] ERROR o.e.lsp4j.jsonrpc.RemoteEndpoint - Internal error: java.lang.NullPointerException: Cannot invoke "org.openrewrite.maven.tree.ResolvedPom.getValue(String)" because "mavenModel" is null java.util.concurrent.CompletionException: java.lang.NullPointerException: Cannot invoke "org.openrewrite.maven.tree.ResolvedPom.getValue(String)" because "mavenModel" is null at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:315) at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:320) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1159) at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1773) at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.exec(CompletableFuture.java:1760) at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) Caused by: java.lang.NullPointerException: Cannot invoke "org.openrewrite.maven.tree.ResolvedPom.getValue(String)" because "mavenModel" is null at org.springframework.ide.vscode.commons.rewrite.maven.MavenIJavaProjectParser.getJavaProvenance(MavenIJavaProjectParser.java:66) at org.springframework.ide.vscode.commons.rewrite.java.ProjectParser.parseModule(ProjectParser.java:58) at org.springframework.ide.vscode.commons.rewrite.java.ProjectParser.parse(ProjectParser.java:50) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.computeWorkspaceEdit(RewriteRecipeRepository.java:370) at org.springframework.ide.vscode.boot.java.rewrite.RewriteRecipeRepository.lambda$apply$18(RewriteRecipeRepository.java:331) at java.base/java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150) ... 8 common frames omitted
To Reproduce Right click on a maven SB project from the Project Explorer, click Spring menu -> Refactor Spring Boot project... or Upgrade Spring Boot version... and select all "Spring Boot 2.x Best practices" or any other recipe. Note that all the Language Servers are enabled (which was the default setting)