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
{{ message }}
Repository navigation
Redhat.java update to version 0.30.0 broke launching/debugging of Spring boot-apps #402
An simple boot app, which was running just fine before suddenly stopped launching properly right after the redhat.java extension was updated to version 0.30.0.
The error looks to me like there's something wrong (missing) from the app's runtime classpath. This cause the app to not properly boot up.
Environment
Operating System: Linux
JDK version: "1.8.0_181"
Visual Studio Code version: 1.26.1
493869ee8e8a846b0855873886fc79d480d342de
x64
Open visual studio code from the attached project's folder with cd hello-world-service and code ..
Press F5 to launch app.
Current Result
Error:
Caused by: java.lang.IllegalStateException: Attempted to load applicationConfig: [classpath:/application.yml] but snakeyaml was not found on the classpath
at org.springframework.boot.env.YamlPropertySourceLoader.load(YamlPropertySourceLoader.java:47)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.loadDocuments(ConfigFileApplicationListener.java:542)
at org.springframework.boot.context.config.ConfigFileApplicationListener$Loader.load(ConfigFileApplicationListener.java:515)
... 23 common frames omitted
Expected Result
App starts succesfully. E.g. you can compare to what supposed to happen by running the app from commandline:
Removing test scope classpath actually sounds like the right thing to do. Having test dependencies on the runtime classpath can also break apps (especially in spring boot where autoconfiguration can easily pick up on the presence of certain things on the classpath and autmatically configure them for use in the app.
However, I suspect that maybe the classpath that vscode-java-debug is using is actually the classpath meant to be used by Java compiler. So it is actually a compile-time classpath, not the classpath that should be used to launch an app. The compile time classpath is different (typically smaller than) the runtime classpath.
The fact that test dependencies where there before was wrong i.m.o, and that it actually made my simple app run is more of an 'accident'. (Two wrongs kind of making things work, because one mistake compensated and fixed the problem caused by another... completely by luck/chance).
Activity
fbricon commentedon Sep 5, 2018
most likely this is caused by runtime dependencies now being flagged to be seen by the test dependencies only. The debugger should ensure runtime dependencies are added to the runtime classpath
andxu commentedon Sep 5, 2018
Fabrizio Ferri (@fabferri) Kris De Volder (@kdvolder) looks like my change of removing test scope classpath, see #399 microsoft/java-debug#202, please add snakeyaml first if it blocks you, I am looking for the reasons.
kdvolder commentedon Sep 5, 2018
Removing test scope classpath actually sounds like the right thing to do. Having test dependencies on the runtime classpath can also break apps (especially in spring boot where autoconfiguration can easily pick up on the presence of certain things on the classpath and autmatically configure them for use in the app.
However, I suspect that maybe the classpath that vscode-java-debug is using is actually the classpath meant to be used by Java compiler. So it is actually a compile-time classpath, not the classpath that should be used to launch an app. The compile time classpath is different (typically smaller than) the runtime classpath.
The fact that test dependencies where there before was wrong i.m.o, and that it actually made my simple app run is more of an 'accident'. (Two wrongs kind of making things work, because one mistake compensated and fixed the problem caused by another... completely by luck/chance).
andxu commentedon Sep 5, 2018
Kris De Volder (@kdvolder) seems we has missed some run-time scope class-entries, thank you very much for noticing us:
maven.pomderived=true
test=true
maven.groupId=org.yaml
maven.artifactId=snakeyaml
maven.version=1.19
maven.scope=runtime
andxu commentedon Sep 6, 2018
Fred Bricon (@fbricon) not sure whether the following logic is right, the isOnlyVisibleByTests will mark runtime scopes test, is it expected?
https://git.eclipse.org/c/m2e/m2e-core.git/tree/org.eclipse.m2e.jdt/src/org/eclipse/m2e/jdt/internal/DefaultClasspathManagerDelegate.java#n166
fbricon commentedon Sep 6, 2018
Andy Xu(devdiv) (@andxu) yes, runtime dependencies are seen by the test code, in Maven. Hence the test flag
andxu commentedon Sep 6, 2018
Fred Bricon (@fbricon), could you please take a look at my code fix?
andxu commentedon Sep 6, 2018
microsoft/java-debug#219
andxu commentedon Sep 6, 2018
Close the issue since hotfix is released