MySQL を使用した Spring Boot アプリケーションが突然停止する
P粉141455512
2023-09-02 10:13:16
<p>我在 application.properties 中有这个:</p>
<pre class="brush:php;toolbar:false;">spring.datasource.url=jdbc:mysql://lin-05779-94506-mysql-primary.servers.linodedb.net:3306/mystic_rivers_db
spring.datasource.username=mystic_rivers_usr
spring.datasource.password=****</pre>
<p>这是我在日志中看到的内容:</p>
<pre class="brush:php;toolbar:false;">2023-07-30T07:54:35,365+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool has sufficient level or currently being filled (queueDepth=0).
2023-07-30T07:55:05,365+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
2023-07-30T07:55:05,366+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool has sufficient level or currently being filled (queueDepth=0).
2023-07-30T07:55:35,367+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
2023-07-30T07:55:35,367+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool has sufficient level or currently being filled (queueDepth=0).
2023-07-30T07:56:05,367+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Pool stats (total=10, active=0, idle=10, waiting=0)
2023-07-30T07:56:05,368+02:00 [HikariPool-1 housekeeper] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Fill pool skipped, pool has sufficient level or currently being filled (queueDepth=0).
2023-07-30T07:56:16,959+02:00 [SpringApplicationShutdownHook] DEBUG o.s.b.a.ApplicationAvailabilityBean - Application availability state ReadinessState changed from ACCEPTING_TRAFFIC to REFUSING_TRAFFIC
2023-07-30T07:56:16,959+02:00 [SpringApplicationShutdownHook] DEBUG o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6ae5aa72
, started on Sun Jul 30 05:13:00 UTC 2023
2023-07-30T07:56:16,961+02:00 [SpringApplicationShutdownHook] DEBUG o.s.c.s.DefaultLifecycleProcessor - Stopping beans in phase 2147482623
2023-07-30T07:56:16,966+02:00 [SpringApplicationShutdownHook] DEBUG o.s.c.s.DefaultLifecycleProcessor - Bean 'webServerGracefulShutdown' completed its stop procedure
2023-07-30T07:56:16,966+02:00 [SpringApplicationShutdownHook] DEBUG o.s.c.s.DefaultLifecycleProcessor - Stopping beans in phase 2147481599
2023-07-30T07:56:16,979+02:00 [SpringApplicationShutdownHook] DEBUG o.s.c.s.DefaultLifecycleProcessor - Bean 'webServerStartStop' completed its stop procedure
2023-07-30T07:56:16,979+02:00 [SpringApplicationShutdownHook] DEBUG o.s.c.s.DefaultLifecycleProcessor - Stopping beans in phase -2147483647
2023-07-30T07:56:16,979+02:00 [SpringApplicationShutdownHook] DEBUG o.s.c.s.DefaultLifecycleProcessor - Bean 'springBootLoggingLifecycle' completed its stop procedure
2023-07-30T07:56:16,979+02:00 [SpringApplicationShutdownHook] DEBUG o.s.s.c.ThreadPoolTaskScheduler - Shutting down ExecutorService 'taskScheduler'
2023-07-30T07:56:16,985+02:00 [SpringApplicationShutdownHook] DEBUG o.s.s.c.ThreadPoolTaskExecutor - Shutting down ExecutorService 'applicationTaskExecutor'
2023-07-30T07:56:16,986+02:00 [SpringApplicationShutdownHook] INFO o.s.o.j.LocalContainerEntityManagerFactoryBean - Closing JPA EntityManagerFactory for persistence unit 'default'
2023-07-30T07:56:16,987+02:00 [SpringApplicationShutdownHook] DEBUG o.h.internal.SessionFactoryImpl - HHH000031: Closing
2023-07-30T07:56:16,987+02:00 [SpringApplicationShutdownHook] DEBUG o.h.type.spi.TypeConfiguration$Scope - Un-scoping TypeConfiguration [org.hibernate.type.spi.TypeConfiguration$Scope@50b75bcb] from SessionFactory [org.hibernate.internal.Session
FactoryImpl@37a9b687]
2023-07-30T07:56:16,987+02:00 [SpringApplicationShutdownHook] DEBUG o.h.s.i.AbstractServiceRegistryImpl - Implicitly destroying ServiceRegistry on de-registration of all child ServiceRegistries
2023-07-30T07:56:16,993+02:00 [SpringApplicationShutdownHook] DEBUG o.h.b.r.i.BootstrapServiceRegistryImpl - Implicitly destroying Boot-strap registry on de-registration of all child ServiceRegistries
2023-07-30T07:56:16,993+02:00 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown initiated...
2023-07-30T07:56:16,993+02:00 [SpringApplicationShutdownHook] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Before shutdown stats (total=10, active=0, idle=10, waiting=0)
2023-07-30T07:56:16,998+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@38124ae7: (connection evicted)
2023-07-30T07:56:16,999+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@792f40dc: (connection evicted)
2023-07-30T07:56:17,001+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@481c79b5: (connection evicted)
2023-07-30T07:56:17,002+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@3fee8b7a: (connection evicted)
2023-07-30T07:56:17,002+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@1efc7e0e: (connection evicted)
2023-07-30T07:56:17,005+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@61a379f: (connection evicted)
2023-07-30T07:56:17,005+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@1f116c25: (connection evicted)
2023-07-30T07:56:17,006+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@22a9ed18: (connection evicted)
2023-07-30T07:56:17,006+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@24bde02: (connection evicted)
2023-07-30T07:56:17,010+02:00 [HikariPool-1 connection closer] DEBUG com.zaxxer.hikari.pool.PoolBase - HikariPool-1 - Closing connection com.mysql.cj.jdbc.ConnectionImpl@4376d439: (connection evicted)
2023-07-30T07:56:17,010+02:00 [SpringApplicationShutdownHook] DEBUG com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - After shutdown stats (total=0, active=0, idle=0, waiting=0)
2023-07-30T07:56:17,010+02:00 [SpringApplicationShutdownHook] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Shutdown completed.</pre>
<p>也在日志中:</p>
<pre class="brush:php;toolbar:false;">2023-07-30T07:13:04,431+02:00 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'entityManagerFactoryBuilder'
2023-07-30T07:13:04,433+02:00 [main] DEBUG o.s.b.f.s.DefaultListableBeanFactory - Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'persistenceManagedTypes'
2023-07-30T07:13:04,451+02:00 [main] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource
2023-07-30T07:13:04,453+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - HikariPool-1 - configuration:
2023-07-30T07:13:04,462+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - allowPoolSuspension.............false
2023-07-30T07:13:04,463+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - autoCommit......................true
2023-07-30T07:13:04,463+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - catalog.........................none
2023-07-30T07:13:04,463+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionInitSql...............none
2023-07-30T07:13:04,464+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionTestQuery.............none
2023-07-30T07:13:04,464+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - connectionTimeout...............30000
2023-07-30T07:13:04,464+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSource......................none
2023-07-30T07:13:04,464+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceClassName.............none
2023-07-30T07:13:04,469+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceJNDI..................none
2023-07-30T07:13:04,472+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - dataSourceProperties............{password=<masked>}
2023-07-30T07:13:04,472+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - driverClassName................."com.mysql.cj.jdbc.Driver"
2023-07-30T07:13:04,472+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - exceptionOverrideClassName......none
2023-07-30T07:13:04,473+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckProperties...........{}
2023-07-30T07:13:04,473+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - healthCheckRegistry.............none
2023-07-30T07:13:04,473+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - idleTimeout.....................600000
2023-07-30T07:13:04,474+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - initializationFailTimeout.......1
2023-07-30T07:13:04,475+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - isolateInternalQueries..........false
2023-07-30T07:13:04,476+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - jdbcUrl.........................jdbc:mysql://lin-1779-145a6-mysql-primary.servers.linodedb.net:3306/mystic_rivers_db
2023-07-30T07:13:04,476+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - keepaliveTime...................0
2023-07-30T07:13:04,476+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - leakDetectionThreshold..........0
2023-07-30T07:13:04,477+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - maxLifetime.....................1800000
2023-07-30T07:13:04,477+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - maximumPoolSize.................10
2023-07-30T07:13:04,478+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - metricRegistry..................none
2023-07-30T07:13:04,478+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - metricsTrackerFactory...........none
2023-07-30T07:13:04,478+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - minimumIdle.....................10
2023-07-30T07:13:04,479+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - password........................<masked>
2023-07-30T07:13:04,479+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - poolName........................"HikariPool-1"
2023-07-30T07:13:04,479+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - readOnly........................false
2023-07-30T07:13:04,479+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - registerMbeans..................false
2023-07-30T07:13:04,479+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - scheduledExecutor...............none
2023-07-30T07:13:04,480+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - schema..........................none
2023-07-30T07:13:04,481+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - threadFactory...................internal
2023-07-30T07:13:04,481+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - transactionIsolation............default
2023-07-30T07:13:04,482+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - username........................"mystic_rivers_usr"
2023-07-30T07:13:04,482+02:00 [main] DEBUG com.zaxxer.hikari.HikariConfig - validationTimeout...............5000
2023-07-30T07:13:04,482+02:00 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
2023-07-30T07:13:05,169+02:00 [main] INFO com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Added connection com.mysql.cj.jdbc.ConnectionImpl@7ca0863b
2023-07-30T07:13:05,170+02:00 [main] INFO com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Start completed.
2023-07-30T07:13:05,228+02:00 [main] DEBUG o.s.o.j.LocalContainerEntityManagerFactoryBean - Building JPA container EntityManagerFactory for persistence unit 'default'
2023-07-30T07:13:05,258+02:00 [main] DEBUG o.h.jpa.internal.util.LogHelper - PersistenceUnitInfo [
name: default
persistence provider classname: null
classloader: TomcatEmbeddedWebappClassLoader
context: ROOT
delegate: true
----------> Parent Classloader:
org.springframework.boot.loader.LaunchedURLClassLoader@5ce65a89
excludeUnlistedClasses: true
JTA datasource: null
Non JTA datasource: HikariDataSource (HikariPool-1)
Transaction type: RESOURCE_LOCAL
PU root URL: file:/usr/local/bin/mystic-rivers-api-0.0.1-SNAPSHOT.jar
Shared Cache Mode: UNSPECIFIED
Validation Mode: AUTO
Jar files URLs []
Managed classes names [</pre></p>
組み込み Tomcat は起動していますか?クラスパスに含まれていますか?
サーブレット コンテナが開始されていない場合、メイン スレッドが終了し、アプリケーションが閉じます。