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

Multi-module handler fails when scanning a project that has only one module #988

Open
Loloweb opened this issue Nov 7, 2023 · 1 comment
Labels
JEE/JAX-WS type: bug Something isn't working wontfix This will not be worked on

Comments

@Loloweb
Copy link

Loloweb commented Nov 7, 2023

Describe the bug
On a Maven multi-module environment project that only contains one module, when trying to apply the migrate-jax-ws recipe, the program returns an error :

Applying recipe 'migrate-jax-ws'
Action [AddDependencies] 'Add spring boot web-services starter' failed: Cannot invoke "org.springframework.sbm.engine.recipe.MultiModuleHandler.handle(org.springframework.sbm.engine.context.ProjectContext)" because "this.multiModuleHandler" is null

SBM Version
tested with release v0.15.0 and when compiled from commit 504c658

SBM Application
spring-boot-migrator with option gitSupportEnabled=false

To Reproduce
Steps to reproduce the behavior:

  1. Scan project
  2. Apply migrate-jax-ws
  3. See error

Expected behavior
A successful jax-ws to Spring Boot base Web-Service migration

Stacktrace

org.springframework.sbm.engine.recipe.ActionFailedException: Action [AddDependencies] 'Add spring boot web-services starter' failed: Cannot invoke "org.springframework.sbm.engine.recipe.MultiModuleHandler.handle(org.springframework.sbm.engine.context.ProjectContext)" because "this.multiModuleHandler" is null
	at org.springframework.sbm.engine.recipe.Action.applyWithStatusEvent(Action.java:43)
	at org.springframework.sbm.engine.recipe.Recipe.apply(Recipe.java:101)
	at org.springframework.sbm.engine.commands.ApplyCommand.execute(ApplyCommand.java:69)
	at org.springframework.sbm.shell.ApplyShellCommand.apply(ApplyShellCommand.java:70)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.shell.command.invocation.InvocableShellMethod.doInvoke(InvocableShellMethod.java:306)
	at org.springframework.shell.command.invocation.InvocableShellMethod.invoke(InvocableShellMethod.java:232)
	at org.springframework.shell.command.CommandExecution$DefaultCommandExecution.evaluate(CommandExecution.java:160)
	at org.springframework.shell.Shell.evaluate(Shell.java:208)
	at org.springframework.shell.Shell.run(Shell.java:140)
	at org.springframework.shell.jline.InteractiveShellRunner.run(InteractiveShellRunner.java:73)
	at org.springframework.shell.DefaultShellApplicationRunner.run(DefaultShellApplicationRunner.java:65)
	at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:762)
	at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:752)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1306)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1295)
	at org.springframework.sbm.SpringShellApplication.main(SpringShellApplication.java:27)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:108)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:65)
Caused by: java.lang.NullPointerException: Cannot invoke "org.springframework.sbm.engine.recipe.MultiModuleHandler.handle(org.springframework.sbm.engine.context.ProjectContext)" because "this.multiModuleHandler" is null
	at org.springframework.sbm.engine.recipe.MultiModuleAwareAction.applyInternal(MultiModuleAwareAction.java:39)
	at org.springframework.sbm.engine.recipe.Action.applyWithStatusEvent(Action.java:37)
	... 28 more

Example Source code to replicate the issue (Optional)
any Maven multi-module environment containing one module should be enough to replicate the issue
image

Desktop (please complete the following information):

  • OS: Ubuntu MATE (VirtualBox)
  • Version 22.04.3 LTS x86_64

Additional context
When applying the recipe after scanning the module instead of the whole project, the program asks you to provide the path to WSDL file for the service. Inputting anything (doesn't matter if it's valid or not) results in an error:

Error processing WSDL file '{path-to-wsdl}'. Cannot invoke "org.openrewrite.ExecutionContext.getMessage(String)" because "this.delegate" is null
Try entering file path again or press 'Enter' to cancel migrating this Web Service
@Loloweb Loloweb added the type: bug Something isn't working label Nov 7, 2023
@fabapp2 fabapp2 added JEE/JAX-WS wontfix This will not be worked on labels Nov 10, 2023
@fabapp2
Copy link
Contributor

fabapp2 commented Nov 10, 2023

Hi @Loloweb thanks for reporting.
I can't look into this at the moment but will keep it open for another day.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JEE/JAX-WS type: bug Something isn't working wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants