You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If a forked spring boot app finishes with exitCode != 0 && exitCode != EXIT_CODE_SIGINT
a MojoExecutionException is thrown with the message "Application finished with exit code: " + exitCode.
This Exception is than catched by the surrounding try-catch and used as cause in a rethrown MojoExecutionException with the misleading/wrong message "Could not exec java".
So the initial thrown Exception is not "silently swallowed" but it is "hidden" as the root cause of the second Exception which exposes a misleading/wrong message.
This happened to me right when starting my spring boot app (had some problem in an ApplicationContextInitializer which was caused due to the problems described in #16819 - my app starts without problems in a non forked VM or when starting the JAR file), so my first thought was that something is wrong with my environment or java installation causing spring boot`s inability to "exec java" - took me quite some time.
Therefore optimizing the exception handling in this place (RunMojo#runWithForkedJvm(...)) would be nice (i.e. more specific error message in first place).
P.S.: Sorry for raising another issue but I'm afraid of creating more off-topic follow-up questions as in #16811 ;-)
The text was updated successfully, but these errors were encountered:
I think it would be safe to change this catch to rethrow any MojoException without wrapping.
wilkinsona
changed the title
spring-boot:run misleading/wrong message "Could not exec java" with a forked VM
Improve diagnostics when JVM launched by spring-boot:run exits with a non-zero status
May 17, 2019
If a forked spring boot app finishes with
exitCode != 0 && exitCode != EXIT_CODE_SIGINT
a
MojoExecutionException
is thrown with the message"Application finished with exit code: " + exitCode
.This Exception is than catched by the surrounding try-catch and used as
cause
in a rethrownMojoExecutionException
with the misleading/wrong message"Could not exec java"
.So the initial thrown Exception is not "silently swallowed" but it is "hidden" as the root cause of the second Exception which exposes a misleading/wrong message.
This happened to me right when starting my spring boot app (had some problem in an
ApplicationContextInitializer
which was caused due to the problems described in #16819 - my app starts without problems in a non forked VM or when starting the JAR file), so my first thought was that something is wrong with my environment or java installation causing spring boot`s inability to "exec java" - took me quite some time.Therefore optimizing the exception handling in this place (
RunMojo#runWithForkedJvm(...)
) would be nice (i.e. more specific error message in first place).P.S.: Sorry for raising another issue but I'm afraid of creating more off-topic follow-up questions as in #16811 ;-)
The text was updated successfully, but these errors were encountered: