(对不起,我的英语不好。)
我在两个地方使用IntelliJ。 (只需试用一下即可了解IDE)
我正在通过git Sharing gradle配置执行相同的spring boot项目。 我确实在两台PC上都设置了热交换(例如devtools,registry ..等)。
但是一个正常工作,另一个却不正常。
我做了如下测试:
运行spring boot应用程序
网页工作正常。
修改控制器代码,例如向控制台添加消息。
和嵌入式tomcat自动重启。
在这里,一台PC可以很好地工作(完美打印添加的消息)
但另一个没有。
tomcat自动重启后,相同的URL显示Whitelabel错误页面。
我对其进行了调查,发现两台计算机之间的某些日志有所不同。
---记录一种有效的产品:
[ 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
-和另一个无效的日志:
[ 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
下面只有其他部分,如果在日志中显示,则热插拔也不起作用。 这可能是一个愚蠢的问题,但我真的很好奇。 你对我有什么建议吗?
**[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**