What is the bug JettyEmbeddedWebAppContext about springboot? - spring

When I use the command java -jar mypro-0.0.1-SNAPSHOT.jar --logging.level.root=TRACE ,the springboot failed ,but some computer could works,
the springboot version is 2.0.0.RELEASE,
<group>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
the log as followers:
2018-07-07 18:02:27.487 DEBUG 21534 --- [ main] o.e.j.u.DecoratedObjectFactory : Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.LongEncoder
2018-07-07 18:02:27.487 DEBUG 21534 --- [ main] o.e.j.u.DecoratedObjectFactory : Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ShortEncoder
2018-07-07 18:02:27.487 DEBUG 21534 --- [ main] o.e.j.u.DecoratedObjectFactory : Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ByteBufferEncoder
2018-07-07 18:02:27.487 DEBUG 21534 --- [ main] o.e.j.u.DecoratedObjectFactory : Creating Instance: class org.eclipse.jetty.websocket.jsr356.encoders.ByteArrayEncoder
2018-07-07 18:02:27.487 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : starting org.springframework.boot.web.embedded.jetty.JettyEmbeddedErrorHandler#7d0b7e3c
2018-07-07 18:02:27.488 INFO 21534 --- [ main] o.e.j.s.h.ContextHandler : Started o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],AVAILABLE}
2018-07-07 18:02:27.488 DEBUG 21534 --- [ main] o.e.j.w.WebAppContext : postConfigure o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],AVAILABLE} with org.springframework.boot.web.embedded.jetty.ServletContextInitializerConfiguration#5824a83d
2018-07-07 18:02:27.488 DEBUG 21534 --- [ main] o.e.j.w.WebAppContext : postConfigure o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],AVAILABLE} with org.springframework.boot.autoconfigure.websocket.servlet.JettyWebSocketServletWebServerCustomizer$1#537f60bf
2018-07-07 18:02:27.488 DEBUG 21534 --- [ main] o.e.j.w.WebAppContext : postConfigure o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],AVAILABLE} with org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory$1#5677323c
2018-07-07 18:02:27.488 DEBUG 21534 --- [ main] o.e.j.w.WebAppContext : postConfigure o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],AVAILABLE} with org.springframework.boot.web.embedded.jetty.JettyServletWebServerFactory$2#18df8434
2018-07-07 18:02:27.488 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : starting org.eclipse.jetty.server.handler.ErrorHandler#a38c7fe
2018-07-07 18:02:27.489 INFO 21534 --- [ main] o.e.j.s.Server : Started #4487ms
2018-07-07 18:02:27.512 DEBUG 21534 --- [ main] o.e.j.s.Server : doStop org.eclipse.jetty.server.Server#2dc54ad4[9.4.8.v20171121]
2018-07-07 18:02:27.513 DEBUG 21534 --- [ main] o.e.j.s.Server : Graceful shutdown org.eclipse.jetty.server.Server#2dc54ad4[9.4.8.v20171121] by
2018-07-07 18:02:27.514 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping org.eclipse.jetty.server.Server#2dc54ad4[9.4.8.v20171121]
2018-07-07 18:02:27.514 INFO 21534 --- [ main] o.e.j.s.session : Stopped scavenging
2018-07-07 18:02:27.514 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping org.eclipse.jetty.server.handler.ErrorHandler#a38c7fe
2018-07-07 18:02:27.514 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],UNAVAILABLE}
2018-07-07 18:02:27.514 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping org.springframework.boot.web.embedded.jetty.JettyEmbeddedErrorHandler#7d0b7e3c
2018-07-07 18:02:27.515 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping org.eclipse.jetty.server.session.SessionHandler1420232606==dftMaxIdleSec=1800
2018-07-07 18:02:27.515 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping org.eclipse.jetty.security.ConstraintSecurityHandler#26e356f0
2018-07-07 18:02:27.515 DEBUG 21534 --- [ main] o.e.j.s.h.AbstractHandler : stopping org.springframework.boot.web.embedded.jetty.JettyEmbeddedWebAppContext$JettyEmbeddedServletHandler#4b8ee4de
2018-07-07 18:02:27.517 INFO 21534 --- [ main] o.e.j.s.h.ContextHandler : Stopped o.s.b.w.e.j.JettyEmbeddedWebAppContext#4310d43{/,[file:///tmp/jetty-docbase.8016560841686360205.13000/],UNAVAILABLE}

Something called Server.stop() which is performing a graceful stop of the server.
The logging line with ...
o.e.j.s.Server : doStop org.eclipse.jetty.server.Server#2dc54ad4[9.4.8.v20171121]
... is telling you this.
You can add a breakpoint within Server.doStop() (the code that handles the .stop() command from the LifeCycle) and see where that call came from.

Related

HikariPool-1 - Exception during pool initialization with SpringBoot and Hibernate and JPA Repository

HikariPool-1 - Exception during pool initialization when trying to run spring-boot application. While running mvn spring-boot:run command, the logs show repositories initialized and server starts and is in running state but throws exception during hikari pool initialization!
Able to connect to the DB using pgAdmin but not able to connect from the application. The code from application.properties is below.
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=10MB
spring.datasource.url= jdbc:postgresql:/34.93.135.89:5433/mtt_04_dec_22
spring.datasource.username= postgres
spring.datasource.password= justdoit#mtt
spring.jpa.hibernate.ddl-auto= none
spring.datasource.testWhileIdle=true
spring.datasource.test-on-borrow=true
spring.datasource.hikari.connectionTimeout=30000
spring.datasource.hikari.maxLifetime=60000
spring.datasource.hikari.maximum-pool-size=30
spring.jpa.open-in-view=false
And Hikari debug logs
PersistenceUnitInfo [name: default]
2022-12-02 11:30:24.569 INFO 14176 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.15.Final
2022-12-02 11:30:24.791 INFO 14176 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2022-12-02 11:30:24.947 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : HikariPool-1 - configuration:
2022-12-02 11:30:24.950 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : allowPoolSuspension.............false
2022-12-02 11:30:24.950 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : autoCommit......................true
2022-12-02 11:30:24.951 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : catalog.........................none
2022-12-02 11:30:24.951 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : connectionInitSql...............none
2022-12-02 11:30:24.951 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : connectionTestQuery.............none
2022-12-02 11:30:24.952 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : connectionTimeout...............30000
2022-12-02 11:30:24.952 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : dataSource......................none
2022-12-02 11:30:24.952 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : dataSourceClassName.............none
2022-12-02 11:30:24.952 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : dataSourceJNDI..................none
2022-12-02 11:30:24.953 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>}
2022-12-02 11:30:24.953 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : driverClassName................."org.postgresql.Driver"
2022-12-02 11:30:24.953 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : exceptionOverrideClassName......none
2022-12-02 11:30:24.954 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : healthCheckProperties...........{}
2022-12-02 11:30:24.954 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : healthCheckRegistry.............none
2022-12-02 11:30:24.954 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : idleTimeout.....................600000
2022-12-02 11:30:24.954 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : initializationFailTimeout.......1
2022-12-02 11:30:24.955 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : isolateInternalQueries..........false
2022-12-02 11:30:24.955 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : jdbcUrl.........................jdbc:postgresql:/35.200.211.39:5432/mtt_04_dec_22
2022-12-02 11:30:24.955 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : leakDetectionThreshold..........0
2022-12-02 11:30:24.955 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : maxLifetime.....................30000
2022-12-02 11:30:24.956 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : maximumPoolSize.................30
2022-12-02 11:30:24.956 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : metricRegistry..................none
2022-12-02 11:30:24.956 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : metricsTrackerFactory...........none
2022-12-02 11:30:24.956 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : minimumIdle.....................30
2022-12-02 11:30:24.956 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : password........................<masked>
2022-12-02 11:30:24.957 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : poolName........................"HikariPool-1"
2022-12-02 11:30:24.957 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : readOnly........................false
2022-12-02 11:30:24.957 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : registerMbeans..................false
2022-12-02 11:30:24.957 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : scheduledExecutor...............none
2022-12-02 11:30:24.957 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : schema..........................none
2022-12-02 11:30:24.958 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : threadFactory...................internal
2022-12-02 11:30:24.958 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : transactionIsolation............default
2022-12-02 11:30:24.958 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : username........................"postgres"
2022-12-02 11:30:24.959 DEBUG 14176 --- [ task-1] com.zaxxer.hikari.HikariConfig : validationTimeout...............5000
EXCEPTION ON CONSOLE LOOKS LIKE:
HikariPool-1 - Exception during pool initialization.
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.3.0.RELEASE)
2022-12-02 09:26:51.258 INFO 14888 --- [ main] org.sadisha.backend.service.Main : Starting Main on DESKTOP-991KNCS with PID 14888 (C:\mttbe\mtt-be\target\classes started by Admin in C:\mttbe\mtt-be)
2022-12-02 09:26:51.265 INFO 14888 --- [ main] org.sadisha.backend.service.Main : No active profile set, falling back to default profiles: default
2022-12-02 09:26:52.481 INFO 14888 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFERRED mode.
2022-12-02 09:26:52.715 INFO 14888 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 220ms. Found 11 JPA repository interfaces.
2022-12-02 09:26:53.776 INFO 14888 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2022-12-02 09:26:53.793 INFO 14888 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2022-12-02 09:26:53.794 INFO 14888 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.35]
2022-12-02 09:26:54.042 INFO 14888 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2022-12-02 09:26:54.043 INFO 14888 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2655 ms
2022-12-02 09:26:54.178 INFO 14888 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2022-12-02 09:26:57.285 ERROR 14888 --- [ main] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: Connection to localhost:5432 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:303) ~[postgresql-42.2.18.jar:42.2.18]
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:51) ~[postgresql-42.2.18.jar:42.2.18]
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:225) ~[postgresql-42.2.18.jar:42.2.18]
at org.postgresql.Driver.makeConnection(Driver.java:465) ~[postgresql-42.2.18.jar:42.2.18]
at org.postgresql.Driver.connect(Driver.java:264) ~[postgresql-42.2.18.jar:42.2.18]
at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:138) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:358) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:206) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:477) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:560) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115) ~[HikariCP-3.4.5.jar:na]
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:112) ~[HikariCP-3.4.5.jar:na]
at org.springframework.jdbc.datasource.DataSourceUtils.fetchConnection(DataSourceUtils.java:158) ~[spring-jdbc-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:116) ~[spring-jdbc-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:79) ~[spring-jdbc-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:324) ~[spring-jdbc-5.2.6.RELEASE.jar:5.2.6.RELEASE]
at org.springframework.boot.jdbc.EmbeddedDatabaseConnection.isEmbedded(EmbeddedDatabaseConnection.java:120) ~[spring-boot-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.isEmbedded(DataSourceInitializer.java:137) ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.isEnabled(DataSourceInitializer.java:129) ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]
at org.springframework.boot.autoconfigure.jdbc.DataSourceInitializer.createSchema(DataSourceInitializer.java:96) ~[spring-boot-autoconfigure-2.3.0.RELEASE.jar:2.3.0.RELEASE]
in your application.properties
change this :
spring.datasource.url=jdbc:postgresql:/34.93.135.89:5433/mtt_04_dec_22
postgresql defaulty adress is 5432 not 5433. probably this is the reason of error
here is you wrote: 34.93.135.89:5433

Spring not showing logs for schema.sql

I am learning spring boot by working on a spring project and attempting to use h2 as an embedded database. Below are the details:
Project Structure:
application.properties file contain:
logging.level.springframework.jdbc.datasource.init.ScriptUtils=debug
spring.jpa.hibernate.ddl-auto=none
The problem is spring boot doesn't show logs for queries inside schema.sql and data.sql.
Logs for reference:
INFO 19121 --- [ main] c.v.l.l.LearningSpringApplication : No active profile set, falling back to default profiles: default
INFO 19121 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
INFO 19121 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 10 ms. Found 0 JPA repository interfaces.
INFO 19121 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 19121 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 19121 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.54]
INFO 19121 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 19121 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1534 ms
INFO 19121 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
INFO 19121 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
INFO 19121 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
INFO 19121 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
INFO 19121 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
INFO 19121 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
INFO 19121 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
INFO 19121 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
WARN 19121 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
INFO 19121 --- [ main] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page: class path resource [static/index.html]
INFO 19121 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
INFO 19121 --- [ main] c.v.l.l.LearningSpringApplication : Started LearningSpringApplication in 3.858 seconds (JVM running for 4.364)
If you use h2 inmemory db with spring-data-jpa, you can see all query in console when hibernate use query to db.
You can see query by add spring.jpa.properties.hibernate.show_sql=true in application.properties.

Unexpected Web-Application closing immediately after starting

These are the current dependencies included in my web application.
dependencies {
implementation("org.springframework.boot:spring-boot-starter-data-jpa")
implementation("org.springframework.boot:spring-boot-starter-data-rest")
implementation("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-web-services")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin")
implementation("org.jetbrains.kotlin:kotlin-reflect")
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
implementation("com.google.firebase:firebase-admin:6.10.0")
}
Every time I run the application I get the following error:
2019-09-30 13:32:38.385 INFO 17104 --- [ restartedMain] unito.taas.project.ProjectApplicationKt : Starting ProjectApplicationKt on LAPTOP-K1DHEJQ6 with PID 17104 (C:\Users\beppe\Desktop\project\TAAS_project\project\build\classes\kotlin\main started by beppe in C:\Users\beppe\Desktop\project\TAAS_project)
2019-09-30 13:32:38.388 INFO 17104 --- [ restartedMain] unito.taas.project.ProjectApplicationKt : No active profile set, falling back to default profiles: default
2019-09-30 13:32:38.444 INFO 17104 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-09-30 13:32:39.177 INFO 17104 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-09-30 13:32:39.263 INFO 17104 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 77ms. Found 3 repository interfaces.
2019-09-30 13:32:39.785 INFO 17104 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-09-30 13:32:39.976 INFO 17104 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-09-30 13:32:40.045 INFO 17104 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2019-09-30 13:32:40.127 INFO 17104 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.3.11.Final}
2019-09-30 13:32:40.128 INFO 17104 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2019-09-30 13:32:40.317 INFO 17104 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.4.Final}
2019-09-30 13:32:40.734 INFO 17104 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2019-09-30 13:32:41.419 INFO 17104 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2019-09-30 13:32:41.439 INFO 17104 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729
2019-09-30 13:32:43.049 INFO 17104 --- [ restartedMain] unito.taas.project.ProjectApplicationKt : Started ProjectApplicationKt in 5.053 seconds (JVM running for 5.806)
2019-09-30 13:32:43.063 INFO 17104 --- [ Thread-9] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2019-09-30 13:32:43.068 INFO 17104 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-09-30 13:32:43.073 INFO 17104 --- [ Thread-9] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
How can I avoid the application closing?
EDIT:
The following is my SpringBoot annotated class
package unito.taas.project
import org.springframework.boot.autoconfigure.SpringBootApplication
import org.springframework.boot.runApplication
#SpringBootApplication
class ProjectApplication
fun main(args: Array<String>) {
runApplication<ProjectApplication>(*args)
}

Can't override bootstrap.properties when run with other profile

I'm trying to run my Spring Boot in local profile with bootstrap-local.properties but It seems not working.
In src/main/resourses I have 2 file: bootstrap.properties and bootstrap-local.properties.
bootstrap.properties
#Application Name
spring.application.name=configserver
#Server port
server.port=8888
# Github URL to connect remote Repository
spring.cloud.config.server.git.uri=https://github.com/TranNgocKhoa/config-respo
# Search path in the remote Repository
spring.cloud.config.server.git.search-paths=config-files*
bootstrap-local.properties
#Application Name
spring.application.name=configserver
#Server port
server.port=8888
# Github URL to connect remote Repository
spring.cloud.config.server.native.search-locations=classpath:/config-respo/config-files
But when I run it with local profile:
2019-03-22 11:20:14.398 INFO 11676 --- [ main] c.h.c.HellodoctorConfigserverApplication : The following profiles are active: local
2019-03-22 11:20:15.185 INFO 11676 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=ce04fc74-ea60-3e26-a1e0-957e7be20901
2019-03-22 11:20:15.210 INFO 11676 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$74797a93] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-03-22 11:20:15.489 INFO 11676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8888 (http)
2019-03-22 11:20:15.514 INFO 11676 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-03-22 11:20:15.514 INFO 11676 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.16]
2019-03-22 11:20:15.523 INFO 11676 --- [ main] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk1.8.0_201\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\Java\jdk1.8.0_201\bin;C:\Program Files\PowerShell\6-preview\preview;C:\Program Files (x86)\VietPN;C:\Program Files\nodejs\;C:\Program Files\apache-maven-3.6.0\bin;C:\Program Files\Git\cmd;C:\Users\khoa1\AppData\Local\Programs\Python\Python37\Scripts\;C:\Users\khoa1\AppData\Local\Programs\Python\Python37\;C:\Users\khoa1\AppData\Local\Microsoft\WindowsApps;;C:\Program Files\JetBrains\IntelliJ IDEA 2018.3.3\bin;;C:\Users\khoa1\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\khoa1\AppData\Roaming\npm;.]
2019-03-22 11:20:15.631 INFO 11676 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-03-22 11:20:15.631 INFO 11676 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1222 ms
2019-03-22 11:20:17.030 INFO 11676 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2019-03-22 11:20:18.049 INFO 11676 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2019-03-22 11:20:18.159 INFO 11676 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path ''
2019-03-22 11:20:18.162 INFO 11676 --- [ main] c.h.c.HellodoctorConfigserverApplication : Started HellodoctorConfigserverApplication in 7.492 seconds (JVM running for 9.255)
2019-03-22 11:20:19.073 INFO 11676 --- [on(1)-10.0.75.1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-03-22 11:20:19.073 INFO 11676 --- [on(1)-10.0.75.1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2019-03-22 11:20:19.082 INFO 11676 --- [on(1)-10.0.75.1] o.s.web.servlet.DispatcherServlet : Completed initialization in 9 ms
When I request to get a configuration, I get a config data that corresponding with when I run in default profile:
http://localhost:8888/hellodoctor-test-service/local
"name": "hellodoctor-test-service",
"profiles": [
"local"
],
"label": null,
"version": "826b53db8aa62950cc42030ba19da8c1a39d3bc7",
"state": null,
"propertySources": [
{
"name": "https://github.com/TranNgocKhoa/config-respo/config-files/hellodoctor-test-service.yml",
"source": {
"spring.zipkin.baseUrl": "http://tracing-server:9411",
"spring.application.name": "hellodoctor-test-service",
"server.port": 8082,
"eureka.client.serviceUrl.defaultZone": "http://${DNS_DISCOVERY_SERVER}:8761/eureka/"
}
}
]
}
You can see that in config data: name": "https://github.com/TranNgocKhoa/config-respo/config-files/hellodoctor-test-service.yml
I'd like to get from local repository.
How can I fix it?
Thank you.

Force to drop the JPA Database

I am using a Spring MVC server and i need to drop the database.
I use this configuration on application.properties:
spring.datasource.url=jdbc:h2:~/test;AUTO_SERVER=TRUE
spring.datasource.driverClassName=org.h2.Driver
spring.jpa.show-sql: true
spring.jpa.hibernate.ddl-auto=create-drop
And I ensure that it is used typing that in the Application's annotation:
#PropertySource("application.properties")
But the tables are not dropped, just they are loaded normally:
2014-11-18 13:30:28.231 INFO 7472 --- [ main] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default'
2014-11-18 13:30:28.250 INFO 7472 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [
name: default
...]
2014-11-18 13:30:28.306 INFO 7472 --- [ main] org.hibernate.Version : HHH000412: Hibernate Core {4.3.1.Final}
2014-11-18 13:30:28.307 INFO 7472 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2014-11-18 13:30:28.308 INFO 7472 --- [ main] org.hibernate.cfg.Environment : HHH000021: Bytecode provider name : javassist
2014-11-18 13:30:28.471 INFO 7472 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {4.0.4.Final}
2014-11-18 13:30:32.894 INFO 7472 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
2014-11-18 13:30:33.010 INFO 7472 --- [ main] o.h.h.i.ast.ASTQueryTranslatorFactory : HHH000397: Using ASTQueryTranslatorFactory
2014-11-18 13:30:33.280 INFO 7472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000228: Running hbm2ddl schema update
2014-11-18 13:30:33.280 INFO 7472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000102: Fetching database metadata
2014-11-18 13:30:33.281 INFO 7472 --- [ main] org.hibernate.tool.hbm2ddl.SchemaUpdate : HHH000396: Updating schema
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000261: Table found: TEST.PUBLIC.CLIENTE
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000037: Columns: [creation_date, id, complete_name, logginname, loggin_name]
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000108: Foreign keys: []
2014-11-18 13:30:33.289 INFO 7472 --- [ main] o.hibernate.tool.hbm2ddl.TableMetadata : HHH000126: Indexes: [primary_key_9]
etc...
I need to force for deleting the database.
You should try setting spring.jpa.hibernate.hbm2ddl.auto=create-drop as per this question.
Also note you need to set the generateDdl to false, due to https://jira.spring.io/browse/SPR-6836 .

Resources