Jhipster generated applications can't be run when VSCODE is running.
Similar to Issue #2359 if VS Code is running (with the vscode & the vscode-java extension enabled) then the java/jhipster/spring boot application will build, start and run successfully 1 time using maven to build and run it (with ./mvnw). However, if you start the application and try to start it a second, or subsequent, times it starts but instead of running the application's main application code, it starts with some kind of default spring boot that logs a generic spring boot banner instead of the application's banner and none of the applications configurations are run, causing it to crash
If VSCode is closed and the application run from a terminal session, then it starts without any issues. Stating VSCode and running it in the same terminal session results in the generic banner, no configuration and crashes.
However, if the maven clean goal is run and/or the target directory is deleted, then it can then be run with VSCode running 1 more time. Although the clean goal usually won't run when VSCode is running as VSCode seems to have a file or something open that prevents the contents of the target directory from being deleted.
Attempting to run the application using the Run or Start Debugging options also does not work. Also, neither one will attempt to build the code if it hasn't already been built using a maven command line.
Run results in the same spring banner instead of the jhipster one:
& 'C:\Program Files\Microsoft\jdk-17.0.2.8-hotspot\bin\java.exe' '@C:\Users\...\AppData\Local\Temp\cp_34nppraci1e1mjdlap9qbh72b.argfile' 'com.epsilon.totalfact.TotalFactApp'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.3)
and Start Debugging also results in the same spring banner:
& 'C:\Program Files\Microsoft\jdk-17.0.2.8-hotspot\bin\java.exe' '-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=localhost:61742' '@C:\Users\...\AppData\Local\Temp\cp_638yastty1iqj9yc9d9bi8dwl.argfile' 'com.epsilon.totalfact.TotalFactApp'
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.3)
This has been happening for a long time, over a year, but I have not been able to get back to the project I have issues with and report this bug until now.
Environment
Operating System: Windows 10 or 11 JDK version: 11 or 17 Visual Studio Code version: 1.81.1 and earlier Java extension (Language Support for Java(TM) by Red Hat) version: 1.21.0 and earlier Java extension (Extension Pack for Java) version: 0.25.13 and earlier
Steps To Reproduce
Generate a JHipster application if you don't already have one. Open a folder with a JHipster/Spring Boot application Attempt too run the application with maven (./mvnw)either from within a VS Code Terminal session or a stand-alone Windows Terminal session The application builds and starts 1 time using maven (./mvnw) but subsequent attempt to run the application it starts, but logs a generic spring banner instead of the jhipster banner and none of the configuration, such as database connections or anything else, is run causing the application to crash.
[Please attach a sample project reproducing the error] I attempted to attach a zipped up sample project, but github won't allow it. All you need to do is generate an application with JHipster (I chose SQL/H2 DB & angular), run it with ./mvnw from a windows terminal session to ensure it starts, then open it with VS Code and try to run it again.
Current Result
[INFO] Attaching agents: []
20:10:46.197 [Thread-0] DEBUG org.springframework.boot.devtools.restart.classloader.RestartClassLoader - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@306afefa
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.7.3)
2023-09-06 20:10:47.017 INFO 23648 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp : Starting TotalFactApp using Java 17.0.6 on WKWUS8364283 with PID 23648 (C:\src\totalfact\target\classes started by murwilso in C:\src\totalfact)
2023-09-06 20:10:47.020 INFO 23648 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp : The following 2 profiles are active: "dev", "local"
2023-09-06 20:10:47.170 INFO 23648 --- [ restartedMain] o.s.b.devtools.restart.ChangeableUrls : The Class-Path manifest attribute in C:\Users\murwilso\.m2\repository\com\oracle\database\jdbc\ojdbc11\21.5.0.0\ojdbc11-21.5.0.0.jar referenced one or more files that do not exist: file:/C:/Users/murwilso/.m2/repository/com/oracle/database/jdbc/ojdbc11/21.5.0.0/oraclepki.jar
2023-09-06 20:10:47.171 INFO 23648 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2023-09-06 20:10:47.172 INFO 23648 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2023-09-06 20:10:48.705 INFO 23648 --- [ restartedMain] o.s.c.a.ConfigurationClassParser : Properties location [classpath:META-INF/build-info.properties] not resolvable: class path resource [META-INF/build-info.properties] cannot be opened because it does not exist
2023-09-06 20:10:48.831 INFO 23648 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2023-09-06 20:10:49.169 INFO 23648 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 323 ms. Found 35 JPA repository interfaces.
2023-09-06 20:10:52.801 WARN 23648 --- [ restartedMain] io.undertow.websockets.jsr : UT026010: Buffer pool was not set on WebSocketDeploymentInfo, the default pool will be used
2023-09-06 20:10:52.851 INFO 23648 --- [ restartedMain] io.undertow.servlet : Initializing Spring embedded WebApplicationContext
2023-09-06 20:10:52.853 INFO 23648 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5679 ms
2023-09-06 20:10:53.135 WARN 23648 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is java.lang.RuntimeException: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webMvcMetricsFilter' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/web/servlet/WebMvcMetricsAutoConfiguration.class]: Unsatisfied dependency expressed through method 'webMvcMetricsFilter' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'prometheusMeterRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/export/prometheus/PrometheusMetricsExportAutoConfiguration.class]: Initialization of bean failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'dataSourcePoolMetadataMeterBinder' defined in class path resource [org/springframework/boot/actuate/autoconfigure/metrics/jdbc/DataSourcePoolMetricsAutoConfiguration$DataSourcePoolMetadataMetricsConfiguration.class]: Unsatisfied dependency expressed through method 'dataSourcePoolMetadataMeterBinder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception; nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2023-09-06 20:10:53.181 INFO 23648 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-09-06 20:10:53.269 ERROR 23648 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev,local are currently active).
Expected Result
[INFO] Attaching agents: []
20:06:12.225 [Thread-0] DEBUG org.springframework.boot.devtools.restart.classloader.RestartClassLoader - Created RestartClassLoader org.springframework.boot.devtools.restart.classloader.RestartClassLoader@48f19e07
██╗ ██╗ ██╗ ████████╗ ███████╗ ██████╗ ████████╗ ████████╗ ███████╗
██║ ██║ ██║ ╚══██╔══╝ ██╔═══██╗ ██╔════╝ ╚══██╔══╝ ██╔═════╝ ██╔═══██╗
██║ ████████║ ██║ ███████╔╝ ╚█████╗ ██║ ██████╗ ███████╔╝
██╗ ██║ ██╔═══██║ ██║ ██╔════╝ ╚═══██╗ ██║ ██╔═══╝ ██╔══██║
╚██████╔╝ ██║ ██║ ████████╗ ██║ ██████╔╝ ██║ ████████╗ ██║ ╚██╗
╚═════╝ ╚═╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══════╝ ╚═╝ ╚═╝
:: JHipster 🤓 :: Running Spring Boot 2.7.3 ::
:: https://www.jhipster.tech ::
2023-09-06T20:06:12.848-04:00 DEBUG 2644 --- [kground-preinit] org.jboss.logging : Logging Provider: org.jboss.logging.Log4j2LoggerProvider
2023-09-06T20:06:12.879-04:00 INFO 2644 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp : Starting TotalFactApp using Java 17.0.6 on WKWUS8364283 with PID 2644 (C:\src\totalfact\target\classes started by murwilso in C:\src\totalfact)
2023-09-06T20:06:12.881-04:00 DEBUG 2644 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp : Running with Spring Boot v2.7.3, Spring v5.3.22
2023-09-06T20:06:12.882-04:00 INFO 2644 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp : The following 3 profiles are active: "dev", "api-docs", "local"
2023-09-06T20:06:16.232-04:00 DEBUG 2644 --- [ restartedMain] i.m.c.u.i.logging.InternalLoggerFactory : Using SLF4J as the default logging framework
2023-09-06T20:06:16.490-04:00 INFO 2644 --- [ restartedMain] c.e.totalfact.config.CacheConfiguration : Defining app-data for local, replicated and distributed modes configuration
2023-09-06T20:06:16.500-04:00 INFO 2644 --- [ restartedMain] c.e.totalfact.config.CacheConfiguration : Defining Infinispan Global Configuration
2023-09-06T21:21:24.668-04:00 DEBUG 13788 --- [ restartedMain] c.e.totalfact.config.AsyncConfiguration : Creating Async Task Executor
2023-09-06T21:21:24.709-04:00 DEBUG 13788 --- [ restartedMain] c.e.t.config.LiquibaseConfiguration : Configuring Liquibase
2023-09-06T21:21:26.098-04:00 WARN 13788 --- [tal-fact-task-1] t.j.c.liquibase.AsyncSpringLiquibase : Starting Liquibase asynchronously, your database might not be ready at startup!
2023-09-06T21:21:26.545-04:00 INFO 13788 --- [ restartedMain] c.SqlFunctionsMetadataBuilderContributor : Oracle functions have been registered.
2
... lots of other logging ...
2023-09-06T21:21:29.827-04:00 DEBUG 13788 --- [ restartedMain] c.e.totalfact.config.WebConfigurer : Registering CORS filter
2023-09-06T21:21:29.864-04:00 INFO 13788 --- [ restartedMain] c.e.totalfact.config.WebConfigurer : Web application configuration, using profiles: dev
2023-09-06T21:21:29.864-04:00 INFO 13788 --- [ restartedMain] c.e.totalfact.config.WebConfigurer : Web application fully configured
2023-09-06T21:21:33.639-04:00 DEBUG 13788 --- [ restartedMain] c.a.JHipsterSpringDocGroupsConfiguration : Initializing JHipster OpenApi customizer
2023-09-06T21:21:34.587-04:00 DEBUG 13788 --- [ restartedMain] c.a.JHipsterSpringDocGroupsConfiguration : Initializing JHipster OpenApi default group
2023-09-06T21:21:34.590-04:00 DEBUG 13788 --- [ restartedMain] c.a.JHipsterSpringDocGroupsConfiguration : Initializing JHipster OpenApi management group
2023-09-06T21:21:34.931-04:00 DEBUG 13788 --- [tal-fact-task-1] t.j.c.liquibase.AsyncSpringLiquibase : Liquibase has updated your database in 8831 ms
2023-09-06T21:21:34.932-04:00 WARN 13788 --- [tal-fact-task-1] t.j.c.liquibase.AsyncSpringLiquibase : Warning, Liquibase took more than 5 seconds to start up!
2023-09-06T21:21:35.687-04:00 DEBUG 13788 --- [ restartedMain] c.e.t.w.f.OAuth2RefreshTokensWebFilter : Filter 'OAuth2RefreshTokensWebFilter' configured for use
2023-09-06T21:21:35.797-04:00 INFO 13788 --- [ restartedMain] org.jboss.threads : JBoss Threads version 2.3.3.Final
2023-09-06T21:21:35.951-04:00 INFO 13788 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp : Started TotalFactApp in 21.617 seconds (JVM running for 22.26)
2023-09-06T21:21:35.964-04:00 INFO 13788 --- [ restartedMain] com.epsilon.totalfact.TotalFactApp :
-----------------------------------------------------------
Application 'TotalFact' is running! Access URLs:
Local: http://localhost:8080/
External: http://192.168.1.66:8080/
Profile(s): [dev, api-docs, local]
----------------------------------------------------------
Additional Informations
We have the same problem, did you find the solution to this problem ?
@naris @enomis-93 I can't reproduce the issue.
Could you attach your project without the /node_modules and /target folders?
@snjeza , totalfact.zip Here is my project. I managed to delete enough to get it to compress with zip under the 20MB limit
@snjeza Please note that the first time you build and run the app it will work. It is the 2nd and subsequent attempts that will have the issue mentioned above.
The best way to duplicate this is to open a Terminal session in VSCode, run ./mvnw, wait for the app to start running. stop it with control-c after it finishes setting up (unless it crashed or quit) then run ./mvnw again
The best way to duplicate this is to open a Terminal session in VSCode, run ./mvnw, wait for the app to start running. stop it with control-c after it finishes setting up (unless it crashed or quit) then run ./mvnw again ... All you need to do is generate an application with JHipster (I chose SQL/H2 DB & angular), run it with ./mvnw from a windows terminal session to ensure it starts, then open it with VS Code and try to run it again.
@naris I have tried ./mvnw several times on Windows and Linux, but haven't suceeded to reproduce the issue.
Here is my project. I managed to delete enough to get it to compress with zip under the 20MB limit
It doesn't start
$ ./mvnw
...
2023-09-14T17:53:25.508+02:00 ERROR 18008 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter : ____***************************__APPLICATION FAILED TO START__***************************____Description:____Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.____Reason: Failed to determine a suitable driver class______Action:____Consider the following:___If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.___If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev,local are currently active).__
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:34 min
[INFO] Finished at: 2023-09-14T17:53:25+02:00
[INFO] ------------------------------------------------------------------------
I've the same problem, did anyone find the solution ? Each time I update my code I need to mvn clean install otherwise I get I same problem.
` 2024-08-18T13:37:33.466-04:00 WARN 80878 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Failed to initialize dependency 'liquibase' of LoadTimeWeaverAware bean 'entityManagerFactory': Error creating bean with name 'liquibase' defined in class path resource [com/didate/config/LiquibaseConfiguration.class]: Failed to instantiate [liquibase.integration.spring.SpringLiquibase]: Factory method 'liquibase' threw exception with message: Error creating bean with name 'dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception with message: Failed to determine a suitable driver class 2024-08-18T13:37:33.472-04:00 INFO 80878 --- [ restartedMain] .s.b.a.l.ConditionEvaluationReportLogger :
Error starting ApplicationContext. To display the condition evaluation report re-run your application with 'debug' enabled. 2024-08-18T13:37:33.482-04:00 ERROR 80878 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
APPLICATION FAILED TO START
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following: If you want an embedded database (H2, HSQL or Derby), please put it on the classpath. If you have database settings to be loaded from a particular profile you may need to activate it (the profiles @spring.profiles.active@ are currently active).`