Hot swap doesn't work with Spring Boot in IntelliJ

Viewed 631

(Sorry for my poor English first of all.)

I'm using IntelliJ in two places. (just trial to know about IDE)

I'm doing the same spring boot project via git sharing gradle configuration. I did setting for hot swap like devtools, registry.. etc) in two PC same.

But one works properly the other is not.

I did test as follow :

  1. run spring boot app

  2. web page works fine.

  3. modify a controller code like adding a message to console.

    and embedded tomcat automatically restart.

  4. HERE, one pc works good (print added message perfectly)

    but the other doesn't.

    after tomcat automatically restart, the same url show Whitelabel Error Page.

I investigated it and found that some logs are different between two pc.

--- logs the one working good :

[  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
[  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
[  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@587affdb, org.springframework.security.web.context.SecurityContextPersistenceFilter@31140227, org.springframework.security.web.header.HeaderWriterFilter@8d6f8a9, org.springframework.web.filter.CharacterEncodingFilter@7b52656a, org.springframework.security.web.authentication.logout.LogoutFilter@79495199, org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter@79292790, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter@8f41e43, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@3851ad6a, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@2585005f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@6db344a5, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@1e39862c, org.springframework.security.web.session.SessionManagementFilter@28677efc, org.springframework.security.web.access.ExceptionTranslationFilter@2a7abf09, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@2e8469aa]
[  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
[  restartedMain] aWebConfiguration$JpaWebMvcConfiguration : 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
[  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 80 (http) with context path ''
[  restartedMain] com.community.CommunityApplication       : Started CommunityApplication in 8.985 seconds (JVM running for 11.655)
[       Thread-5] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
[       Thread-5] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
[       Thread-5] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
[       Thread-5] o.s.b.f.support.DisposableBeanAdapter    : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-197]
[       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
[       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
          __ _ _
 _  __ _ \ \ \ \
 \/ _` | \ \ \ \
 || (_| |  ) ) ) )
  |_\__, | / / / /
 ==|___/=/_/_/_/
  (v2.1.2.RELEASE)
[  restartedMain] com.community.CommunityApplication       : Starting CommunityApplication on PC with PID 16868 (C:\work\IntelliJ\SpringBootCommunityWeb\out\production\classes started by  in C:\work\IntelliJ\SpringBootCommunityWeb)
[  restartedMain] com.community.CommunityApplication       : No active profile set, falling back to default profiles: default
[  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
[  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 40ms. Found 2 repository interfaces.
[  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$a49563c] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 80 (http)
[  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
[  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.14]
[  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
[  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 1177 ms
[  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-2 - Starting...
[  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-2 - Start completed.
[  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
[  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
[  restartedMain] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@56c75fda'
[  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
[  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
[  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@34a525ca, org.springframework.security.web.context.SecurityContextPersistenceFilter@1528961c, org.springframework.security.web.header.HeaderWriterFilter@7b2b261c, org.springframework.web.filter.CharacterEncodingFilter@63956f7c, org.springframework.security.web.authentication.logout.LogoutFilter@7246e327, org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter@8fbe389, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter@e7ddca2, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@738e18a0, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@71f1699c, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@53c8ba78, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@3ed2760, org.springframework.security.web.session.SessionManagementFilter@4c4dac5a, org.springframework.security.web.access.ExceptionTranslationFilter@37fa78f5, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@74967f44]
[  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
[  restartedMain] aWebConfiguration$JpaWebMvcConfiguration : 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
[  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 80 (http) with context path ''
[  restartedMain] com.community.CommunityApplication       : Started CommunityApplication in 2.114 seconds (JVM running for 121.368)
[  restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged

-- and the other one's logs that doesn't work :

[  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
[  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@8a78527, org.springframework.security.web.context.SecurityContextPersistenceFilter@7bf935e4, org.springframework.security.web.header.HeaderWriterFilter@6d018b44, org.springframework.web.filter.CharacterEncodingFilter@377ccf52, org.springframework.security.web.authentication.logout.LogoutFilter@3dd9bc77, org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter@2ea4eccc, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter@1de22b60, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@14a9769c, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@8cd9504, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@4add6362, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@2d6a7513, org.springframework.security.web.session.SessionManagementFilter@32857a38, org.springframework.security.web.access.ExceptionTranslationFilter@6c9237d8, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@3e410962]
[  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
[  restartedMain] aWebConfiguration$JpaWebMvcConfiguration : 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
[  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 80 (http) with context path ''
[  restartedMain] com.community.CommunityApplication       : Started CommunityApplication in 15.879 seconds (JVM running for 18.138)
**[p-nio-80-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
[p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
[p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 17 ms
[p-nio-80-exec-1] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory**
[       Thread-5] o.s.s.concurrent.ThreadPoolTaskExecutor  : Shutting down ExecutorService 'applicationTaskExecutor'
[       Thread-5] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
[       Thread-5] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed evictData of schema as part of SessionFactory shut-down'
[       Thread-5] o.s.b.f.support.DisposableBeanAdapter    : Invocation of destroy method failed on bean with name 'inMemoryDatabaseShutdownExecutor': org.h2.jdbc.JdbcSQLException: Database is already closed (to disable automatic closing at VM shutdown, add ";DB_CLOSE_ON_EXIT=FALSE" to the db URL) [90121-197]
[       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
[       Thread-5] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
      __ _ _
 _  __ _ \ \ \ \
 \/ _` | \ \ \ \
 || (_| |  ) ) ) )
  |_\__, | / / / /
 ==|___/=/_/_/_/
  (v2.1.2.RELEASE)
[  restartedMain] com.community.CommunityApplication       : Starting CommunityApplication on PC with PID 8468 (C:\workspace\SpringBoot\out\production\classes started by in C:\workspace\SpringBoot)
[  restartedMain] com.community.CommunityApplication       : No active profile set, falling back to default profiles: default
[  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
[  restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 111ms. Found 2 repository interfaces.
[  restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$5ebc4d71] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port(s): 80 (http)
[  restartedMain] o.apache.catalina.core.StandardService   : Starting service [Tomcat]
[  restartedMain] org.apache.catalina.core.StandardEngine  : Starting Servlet engine: [Apache Tomcat/9.0.14]
[  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
[  restartedMain] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 2766 ms
[  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-2 - Starting...
[  restartedMain] com.zaxxer.hikari.HikariDataSource       : HikariPool-2 - Start completed.
[  restartedMain] o.hibernate.jpa.internal.util.LogHelper  : HHH000204: Processing PersistenceUnitInfo [
[  restartedMain] org.hibernate.dialect.Dialect            : HHH000400: Using dialect: org.hibernate.dialect.H2Dialect
[  restartedMain] o.h.t.schema.internal.SchemaCreatorImpl  : HHH000476: Executing import script 'org.hibernate.tool.schema.internal.exec.ScriptSourceInputNonExistentImpl@2812f6b8'
[  restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
[  restartedMain] o.s.b.d.a.OptionalLiveReloadServer       : LiveReload server is running on port 35729
[  restartedMain] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@267bc281, org.springframework.security.web.context.SecurityContextPersistenceFilter@2afc1d8, org.springframework.security.web.header.HeaderWriterFilter@5962cf57, org.springframework.web.filter.CharacterEncodingFilter@7790e093, org.springframework.security.web.authentication.logout.LogoutFilter@77bf42d5, org.springframework.security.oauth2.client.web.OAuth2AuthorizationRequestRedirectFilter@319c14c1, org.springframework.security.oauth2.client.web.OAuth2LoginAuthenticationFilter@37184e4e, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@5cff9178, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@97e2d0c, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@46a95303, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@28faa11, org.springframework.security.web.session.SessionManagementFilter@796d63d, org.springframework.security.web.access.ExceptionTranslationFilter@732f1ea7, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@1fccb650]
[  restartedMain] o.s.s.concurrent.ThreadPoolTaskExecutor  : Initializing ExecutorService 'applicationTaskExecutor'
[  restartedMain] aWebConfiguration$JpaWebMvcConfiguration : 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
[  restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat started on port(s): 80 (http) with context path ''
[  restartedMain] com.community.CommunityApplication       : Started CommunityApplication in 4.412 seconds (JVM running for 80.618)
[  restartedMain] .ConditionEvaluationDeltaLoggingListener : Condition evaluation unchanged
[p-nio-80-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
[p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
[p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 19 ms

Only different part is below and hot swap doesn't work if this shows in logs. This could be a stupid question but I'm really wonder. Do you have any suggestion for me?

**[p-nio-80-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
    [p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
    [p-nio-80-exec-1] o.s.web.servlet.DispatcherServlet        : Completed initialization in 17 ms
    [p-nio-80-exec-1] o.h.h.i.QueryTranslatorFactoryInitiator  : HHH000397: Using ASTQueryTranslatorFactory**
0 Answers
Related