Hibernate - Dialect configured but still getting error - spring-boot
I'm updating a JHipster microservice and found some issues when running the app in production environment. The application crashes with a strange Hibernate error:
2020-10-22 10:59:12.755 INFO 1 --- [ main] com.hazelcast.core.LifecycleService : [172.18.0.3]:5701 [dev] [3.12.7] [172.18.0.3]:5701 is STARTED
2020-10-22 10:59:13.066 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : Driver class org.postgresql.Driver found in Thread context class loader jdk.internal.loader.ClassLoaders$AppClassLoader#4ae3c1cd
2020-10-22 10:59:13.868 INFO 1 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1603364353868, current=UP, previous=STARTING]
2020-10-22 10:59:13.946 INFO 1 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MISCELLANEOUS/miscellaneous:2b1983b040c376288a15e1a536a4f8f9: registering service...
2020-10-22 10:59:14.182 INFO 1 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MISCELLANEOUS/miscellaneous:2b1983b040c376288a15e1a536a4f8f9 - registration status: 204
2020-10-22 10:59:14.257 INFO 1 --- [ main] t.h.e.m.config.WebConfigurer : Web application configuration, using profiles: prod
2020-10-22 10:59:14.258 INFO 1 --- [ main] t.h.e.m.config.WebConfigurer : Web application fully configured
2020-10-22 10:59:14.961 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : Hikari - configuration:
2020-10-22 10:59:14.969 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : allowPoolSuspension.............false
2020-10-22 10:59:14.969 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : autoCommit......................false
2020-10-22 10:59:14.969 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : catalog.........................none
2020-10-22 10:59:14.970 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : connectionInitSql...............none
2020-10-22 10:59:14.970 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : connectionTestQuery.............none
2020-10-22 10:59:14.971 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : connectionTimeout...............30000
2020-10-22 10:59:14.971 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSource......................none
2020-10-22 10:59:14.971 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSourceClassName.............none
2020-10-22 10:59:14.972 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSourceJNDI..................none
2020-10-22 10:59:15.042 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>}
2020-10-22 10:59:15.043 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : driverClassName................."org.postgresql.Driver"
2020-10-22 10:59:15.043 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : exceptionOverrideClassName......none
2020-10-22 10:59:15.044 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : healthCheckProperties...........{}
2020-10-22 10:59:15.045 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : healthCheckRegistry.............none
2020-10-22 10:59:15.045 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : idleTimeout.....................600000
2020-10-22 10:59:15.047 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : initializationFailTimeout.......1
2020-10-22 10:59:15.048 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : isolateInternalQueries..........false
2020-10-22 10:59:15.049 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : jdbcUrl.........................jdbc:postgresql://postgresql:5432/miscellaneous?socketTimeout=30
2020-10-22 10:59:15.050 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : leakDetectionThreshold..........15000
2020-10-22 10:59:15.050 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : maxLifetime.....................1800000
2020-10-22 10:59:15.050 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : maximumPoolSize.................5
2020-10-22 10:59:15.051 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : metricRegistry..................none
2020-10-22 10:59:15.051 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : metricsTrackerFactory...........none
2020-10-22 10:59:15.051 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : minimumIdle.....................5
2020-10-22 10:59:15.054 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : password........................<masked>
2020-10-22 10:59:15.055 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : poolName........................"Hikari"
2020-10-22 10:59:15.056 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : readOnly........................false
2020-10-22 10:59:15.057 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : registerMbeans..................false
2020-10-22 10:59:15.059 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : scheduledExecutor...............none
2020-10-22 10:59:15.059 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : schema..........................none
2020-10-22 10:59:15.059 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : threadFactory...................internal
2020-10-22 10:59:15.060 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : transactionIsolation............default
2020-10-22 10:59:15.061 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : username........................"teste"
2020-10-22 10:59:15.064 DEBUG 1 --- [ main] com.zaxxer.hikari.HikariConfig : validationTimeout...............5000
2020-10-22 10:59:15.065 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : Hikari - Starting...
2020-10-22 10:59:15.445 DEBUG 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : Hikari - Added connection org.postgresql.jdbc.PgConnection#47d6a31a
2020-10-22 10:59:15.450 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : Hikari - Start completed.
2020-10-22 10:59:15.550 DEBUG 1 --- [ari housekeeper] com.zaxxer.hikari.pool.HikariPool : Hikari - Pool stats (total=1, active=1, idle=0, waiting=0)
2020-10-22 10:59:15.566 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : Hikari - Added connection org.postgresql.jdbc.PgConnection#c2d5356
2020-10-22 10:59:15.573 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : Hikari - Added connection org.postgresql.jdbc.PgConnection#2eaaca3
2020-10-22 10:59:15.643 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : Hikari - Added connection org.postgresql.jdbc.PgConnection#6d53826
2020-10-22 10:59:15.654 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : Hikari - Added connection org.postgresql.jdbc.PgConnection#43d7a698
2020-10-22 10:59:15.659 DEBUG 1 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : Hikari - After adding stats (total=5, active=1, idle=4, waiting=0)
2020-10-22 10:59:28.156 WARN 1 --- [scoveryClient-0] c.netflix.discovery.TimedSupervisorTask : task supervisor timed out
java.util.concurrent.TimeoutException: null
at java.base/java.util.concurrent.FutureTask.get(Unknown Source)
at com.netflix.discovery.TimedSupervisorTask.run(TimedSupervisorTask.java:68)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.base/java.lang.Thread.run(Unknown Source)
2020-10-22 10:59:30.453 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : Hikari - Shutdown initiated...
2020-10-22 10:59:30.454 DEBUG 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : Hikari - Before shutdown stats (total=5, active=0, idle=5, waiting=0)
2020-10-22 10:59:30.465 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : Hikari - Closing connection org.postgresql.jdbc.PgConnection#47d6a31a: (connection evicted)
2020-10-22 10:59:30.471 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : Hikari - Closing connection org.postgresql.jdbc.PgConnection#c2d5356: (connection evicted)
2020-10-22 10:59:30.544 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : Hikari - Closing connection org.postgresql.jdbc.PgConnection#2eaaca3: (connection evicted)
2020-10-22 10:59:30.545 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : Hikari - Closing connection org.postgresql.jdbc.PgConnection#6d53826: (connection evicted)
2020-10-22 10:59:30.548 DEBUG 1 --- [nnection closer] com.zaxxer.hikari.pool.PoolBase : Hikari - Closing connection org.postgresql.jdbc.PgConnection#43d7a698: (connection evicted)
2020-10-22 10:59:30.564 DEBUG 1 --- [ main] com.zaxxer.hikari.pool.HikariPool : Hikari - After shutdown stats (total=0, active=0, idle=0, waiting=0)
2020-10-22 10:59:30.564 INFO 1 --- [ main] com.zaxxer.hikari.HikariDataSource : Hikari - Shutdown completed.
2020-10-22 10:59:30.565 WARN 1 --- [ main] i.g.j.c.liquibase.AsyncSpringLiquibase : Warning, Liquibase took more than 5 seconds to start up!
2020-10-22 10:59:31.050 DEBUG 1 --- [ main] o.hibernate.jpa.internal.util.LogHelper : PersistenceUnitInfo [
name: default
persistence provider classname: null
classloader: jdk.internal.loader.ClassLoaders$AppClassLoader#4ae3c1cd
excludeUnlistedClasses: true
JTA datasource: null
Non JTA datasource: HikariDataSource (Hikari)
Transaction type: RESOURCE_LOCAL
PU root URL: file:/app/libs/commons-microservice-1.1.0.jar
Shared Cache Mode: UNSPECIFIED
Validation Mode: AUTO
Jar files URLs []
Managed classes names [
tech.h2r.ecommerce.miscellaneous.domain.AbstractAuditingEntity
tech.h2r.ecommerce.miscellaneous.domain.Banner
tech.h2r.ecommerce.miscellaneous.domain.CustomPage
tech.h2r.ecommerce.miscellaneous.domain.DirectMail
tech.h2r.ecommerce.miscellaneous.domain.PersistentAuditEvent
tech.h2r.ecommerce.miscellaneous.domain.Theme
tech.h2r.commons.microservice.domain.ConsumedMessage
tech.h2r.commons.microservice.domain.ProducedMessage
tech.h2r.commons.domain.Config]
Mapping files names []
Properties []
2020-10-22 10:59:31.064 DEBUG 1 --- [ main] o.h.i.internal.IntegratorServiceImpl : Adding Integrator [org.hibernate.cfg.beanvalidation.BeanValidationIntegrator].
2020-10-22 10:59:31.066 DEBUG 1 --- [ main] o.h.i.internal.IntegratorServiceImpl : Adding Integrator [org.hibernate.secure.spi.JaccIntegrator].
2020-10-22 10:59:31.068 DEBUG 1 --- [ main] o.h.i.internal.IntegratorServiceImpl : Adding Integrator [org.hibernate.cache.internal.CollectionCacheInvalidator].
2020-10-22 10:59:31.270 INFO 1 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.15.Final
2020-10-22 10:59:31.343 DEBUG 1 --- [ main] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found
2020-10-22 10:59:31.851 DEBUG 1 --- [ main] o.hibernate.service.spi.ServiceBinding : Overriding existing service binding [org.hibernate.secure.spi.JaccService]
2020-10-22 10:59:31.867 DEBUG 1 --- [ main] o.h.c.internal.RegionFactoryInitiator : Cannot default RegionFactory based on registered strategies as `[]` RegionFactory strategies were registered
2020-10-22 10:59:31.868 DEBUG 1 --- [ main] o.h.c.internal.RegionFactoryInitiator : Cache region factory : org.hibernate.cache.internal.NoCachingRegionFactory
2020-10-22 10:59:31.960 INFO 1 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2020-10-22 10:59:32.769 DEBUG 1 --- [ main] o.h.boot.internal.BootstrapContextImpl : Injecting JPA temp ClassLoader [org.springframework.instrument.classloading.SimpleThrowawayClassLoader#20852557] into BootstrapContext; was [null]
2020-10-22 10:59:32.770 DEBUG 1 --- [ main] o.h.boot.internal.ClassLoaderAccessImpl : ClassLoaderAccessImpl#injectTempClassLoader(org.springframework.instrument.classloading.SimpleThrowawayClassLoader#20852557) [was null]
2020-10-22 10:59:32.771 DEBUG 1 --- [ main] o.h.boot.internal.BootstrapContextImpl : Injecting ScanEnvironment [org.hibernate.jpa.boot.internal.StandardJpaScanEnvironmentImpl#41ca7df9] into BootstrapContext; was [null]
2020-10-22 10:59:32.842 DEBUG 1 --- [ main] o.h.boot.internal.BootstrapContextImpl : Injecting ScanOptions [org.hibernate.boot.archive.scan.internal.StandardScanOptions#4f0908de] into BootstrapContext; was [org.hibernate.boot.archive.scan.internal.StandardScanOptions#19469022]
2020-10-22 10:59:33.153 DEBUG 1 --- [ main] o.h.boot.internal.BootstrapContextImpl : Injecting JPA temp ClassLoader [null] into BootstrapContext; was [org.springframework.instrument.classloading.SimpleThrowawayClassLoader#20852557]
2020-10-22 10:59:33.160 DEBUG 1 --- [ main] o.h.boot.internal.ClassLoaderAccessImpl : ClassLoaderAccessImpl#injectTempClassLoader(null) [was org.springframework.instrument.classloading.SimpleThrowawayClassLoader#20852557]
2020-10-22 10:59:33.243 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [uuid2] -> [org.hibernate.id.UUIDGenerator]
2020-10-22 10:59:33.243 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [guid] -> [org.hibernate.id.GUIDGenerator]
2020-10-22 10:59:33.244 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [uuid] -> [org.hibernate.id.UUIDHexGenerator]
2020-10-22 10:59:33.245 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [uuid.hex] -> [org.hibernate.id.UUIDHexGenerator]
2020-10-22 10:59:33.245 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [assigned] -> [org.hibernate.id.Assigned]
2020-10-22 10:59:33.247 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [identity] -> [org.hibernate.id.IdentityGenerator]
2020-10-22 10:59:33.249 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [select] -> [org.hibernate.id.SelectGenerator]
2020-10-22 10:59:33.251 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [sequence] -> [org.hibernate.id.enhanced.SequenceStyleGenerator]
2020-10-22 10:59:33.253 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [seqhilo] -> [org.hibernate.id.SequenceHiLoGenerator]
2020-10-22 10:59:33.254 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [increment] -> [org.hibernate.id.IncrementGenerator]
2020-10-22 10:59:33.255 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [foreign] -> [org.hibernate.id.ForeignGenerator]
2020-10-22 10:59:33.256 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [sequence-identity] -> [org.hibernate.id.SequenceIdentityGenerator]
2020-10-22 10:59:33.256 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [enhanced-sequence] -> [org.hibernate.id.enhanced.SequenceStyleGenerator]
2020-10-22 10:59:33.258 DEBUG 1 --- [ main] .i.f.i.DefaultIdentifierGeneratorFactory : Registering IdentifierGenerator strategy [enhanced-table] -> [org.hibernate.id.enhanced.TableGenerator]
2020-10-22 10:59:33.262 WARN 1 --- [ main] o.h.e.j.e.i.JdbcEnvironmentInitiator : HHH000342: Could not obtain connection to query metadata : HikariDataSource HikariDataSource (Hikari) has been closed.
2020-10-22 10:59:33.266 WARN 1 --- [ main] 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 [tech/h2r/ecommerce/miscellaneous/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2020-10-22 10:59:33.365 INFO 1 --- [ main] com.hazelcast.core.LifecycleService : [172.18.0.3]:5701 [dev] [3.12.7] [172.18.0.3]:5701 is SHUTTING_DOWN
2020-10-22 10:59:33.449 INFO 1 --- [ main] com.hazelcast.instance.Node : [172.18.0.3]:5701 [dev] [3.12.7] Shutting down connection manager...
2020-10-22 10:59:33.457 INFO 1 --- [ main] com.hazelcast.instance.Node : [172.18.0.3]:5701 [dev] [3.12.7] Shutting down node engine...
2020-10-22 10:59:33.547 INFO 1 --- [ main] com.hazelcast.instance.NodeExtension : [172.18.0.3]:5701 [dev] [3.12.7] Destroying node NodeExtension.
2020-10-22 10:59:33.548 INFO 1 --- [ main] com.hazelcast.instance.Node : [172.18.0.3]:5701 [dev] [3.12.7] Hazelcast Shutdown is completed in 101 ms.
2020-10-22 10:59:33.549 INFO 1 --- [ main] com.hazelcast.core.LifecycleService : [172.18.0.3]:5701 [dev] [3.12.7] [172.18.0.3]:5701 is SHUTDOWN
2020-10-22 10:59:33.550 INFO 1 --- [ main] t.h.e.m.config.CacheConfiguration : Closing Cache Manager
2020-10-22 10:59:33.554 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Shutting down DiscoveryClient ...
2020-10-22 10:59:36.557 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Unregistering ...
2020-10-22 10:59:36.666 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : DiscoveryClient_MISCELLANEOUS/miscellaneous:2b1983b040c376288a15e1a536a4f8f9 - deregister status: 200
2020-10-22 10:59:36.744 INFO 1 --- [ main] com.netflix.discovery.DiscoveryClient : Completed shut down of DiscoveryClient
2020-10-22 10:59:36.951 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [tech/h2r/ecommerce/miscellaneous/config/DatabaseConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1796)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:595)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:226)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1108)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at tech.h2r.ecommerce.miscellaneous.MiscellaneousApp.main(MiscellaneousApp.java:44)
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.<init>(InFlightMetadataCollectorImpl.java:176)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:118)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1214)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1245)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792)
... 14 common frames omitted
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when 'hibernate.dialect' not set
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
... 31 common frames omitted
The error says the problem is with dialect, but it is configured correctly:
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:postgresql://postgresql:5432/miscellaneous?socketTimeout=30
hikari:
poolName: Hikari
auto-commit: false
jpa:
database-platform: io.github.jhipster.domain.util.FixedPostgreSQL10Dialect
show-sql: false
open-in-view: false
properties:
hibernate.jdbc.time_zone: UTC
hibernate.id.new_generator_mappings: true
hibernate.connection.provider_disables_autocommit: true
hibernate.cache.use_second_level_cache: true
hibernate.cache.use_query_cache: false
hibernate.generate_statistics: false
hibernate.jdbc.batch_size: 25
hibernate.order_inserts: true
hibernate.order_updates: true
hibernate.query.fail_on_pagination_over_collection_fetch: true
hibernate.query.in_clause_parameter_padding: true
hibernate.cache.region.factory_class: com.hazelcast.hibernate.HazelcastCacheRegionFactory
hibernate.cache.use_minimal_puts: true
hibernate.cache.hazelcast.instance_name: miscellaneous
hibernate.cache.hazelcast.use_lite_member: true
hibernate:
ddl-auto: none
naming:
physical-strategy: org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy
implicit-strategy: org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy
What could be causing this problem?
Instead of use the injected jpaVendorAdapter in my EntityManager, I was creating it:
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, SchemaPerTenantConnectionProvider schemaPerTenantConnectionProvider, HeaderTenantIdentifierResolver headerTenantIdentifierResolver) {
...
em.setJpaVendorAdapter(jpaVendorAdapter());
em.setJpaPropertyMap(properties);
return em;
}
simply using the injected bean solved this problem:
#Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource, SchemaPerTenantConnectionProvider schemaPerTenantConnectionProvider, HeaderTenantIdentifierResolver headerTenantIdentifierResolver, JpaVendorAdapter jpaVendorAdapter) {
...
em.setJpaVendorAdapter(jpaVendorAdapter);
em.setJpaPropertyMap(properties);
return em;
}
Add the dialect to the properties under the name hibernate.dialect.
Related
Inside docker container Eureka doesn't see the defaultZone parameter value in properties.yml
There are no problems happens if I'm launching apps without containers. My temporary solution is to send the parameter through environment variable, but I can't understand why does it work like this. Could somebody please explain what am I doing wrong? application-docker.yml (api-gateway) server: port: 8080 spring: application: name: api-gateway cloud: gateway: routes: - id: customer uri: lb://CUSTOMER predicates: - Path=/api/v1/customers/** zipkin: base-url: http://zipkin:9411/ eureka: client: serviceUrl: defaultZone: http://eureka-server:8761/eureka/ fetch-registry: true register-with-eureka: true application-docker.yml (eureka-server) server: port: 8761 spring: application: name: eureka-server zipkin: base-url: http://zipkin:9411/ eureka: client: fetch-registry: false register-with-eureka: false docker-compose.yaml services: postgres: container_name: postgres image: postgres environment: POSTGRES_USER: * POSTGRES_PASSWORD: * PGDATA: /data/postgres volumes: - postgres:/data/postgres ports: - "5432:5432" networks: - postgres restart: unless-stopped zipkin: image: openzipkin/zipkin container_name: zipkin ports: - "9411:9411" networks: - spring rabbitmq: image: rabbitmq:3.9.11-management-alpine container_name: rabbitmq ports: - "5672:5672" - "15672:15672" networks: - spring eureka-server: image: ftmpt/eureka-server:latest container_name: eureka-server environment: - SPRING_PROFILES_ACTIVE=docker ports: - "8761:8761" networks: - spring depends_on: - zipkin api-gateway: image: ftmpt/api-gateway:latest container_name: api-gateway environment: - SPRING_PROFILES_ACTIVE=docker # - eureka.client.service-url.defaultZone=http://eureka-server:8761/eureka ports: - "8080:8080" networks: - spring - postgres depends_on: - eureka-server - zipkin networks: postgres: driver: bridge spring: driver: bridge volumes: postgres: logs from api-gateway container: Powered by Spring Boot 2.5.7 2022-10-03 16:19:28.632 INFO [api-gateway,,] 1 --- [ main] e.fatumepta.apigw.ApiGatewayApplication : Starting ApiGatewayApplication using Java 17.0.1 on f492a34f31a2 with PID 1 (/app/classes started by root in /) 2022-10-03 16:19:28.640 INFO [api-gateway,,] 1 --- [ main] e.fatumepta.apigw.ApiGatewayApplication : The following profiles are active: docker 2022-10-03 16:19:31.883 INFO [api-gateway,,] 1 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=7282d2ab-5b80-3882-a881-0bf42ac5f5e5 2022-10-03 16:19:32.624 INFO [api-gateway,,] 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2022-10-03 16:19:32.638 INFO [api-gateway,,] 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig' of type [org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerBeanPostProcessorAutoConfiguration$ReactorDeferringLoadBalancerFilterConfig] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2022-10-03 16:19:32.647 INFO [api-gateway,,] 1 --- [ main] trationDelegate$BeanPostProcessorChecker : Bean 'reactorDeferringLoadBalancerExchangeFilterFunction' of type [org.springframework.cloud.client.loadbalancer.reactive.DeferringLoadBalancerExchangeFilterFunction] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [After] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Before] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Between] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Cookie] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Header] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Host] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Method] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Path] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Query] 2022-10-03 16:19:34.880 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [ReadBody] 2022-10-03 16:19:34.881 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [RemoteAddr] 2022-10-03 16:19:34.881 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [Weight] 2022-10-03 16:19:34.881 INFO [api-gateway,,] 1 --- [ main] o.s.c.g.r.RouteDefinitionRouteLocator : Loaded RoutePredicateFactory [CloudFoundryRouteService] 2022-10-03 16:19:36.003 INFO [api-gateway,,] 1 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses RestTemplate. 2022-10-03 16:19:36.316 WARN [api-gateway,,] 1 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath. 2022-10-03 16:19:36.509 INFO [api-gateway,,] 1 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2022-10-03 16:19:36.782 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1 2022-10-03 16:19:36.800 INFO [api-gateway,,] 1 --- [ main] c.n.d.s.r.aws.ConfigClusterResolver : Resolving eureka endpoints via configuration 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Disable delta property : false 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Single vip registry refresh property : null 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Force full registry fetch : false 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Application is null : false 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Registered Applications size is zero : true 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Application version is -1: true 2022-10-03 16:19:36.843 INFO [api-gateway,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Getting all instance registry info from the eureka server 2022-10-03 16:19:37.584 INFO [api-gateway,,] 1 --- [ main] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error. endpoint=DefaultEndpoint{ serviceUrl='http://localhost:8761/eureka/}, exception=I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused stacktrace=org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8761/eureka/apps/": Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused; nested exception is org.apache.http.conn.HttpHostConnectException: Connect to localhost:8761 [localhost/127.0.0.1] failed: Connection refused at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:785) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:711) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:602) at org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient.getApplicationsInternal(RestTemplateEurekaHttpClient.java:145) at org.springframework.cloud.netflix.eureka.http.RestTemplateEurekaHttpClient.getApplications(RestTemplateEurekaHttpClient.java:135) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:121) at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:80) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:120) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$6.execute(EurekaHttpClientDecorator.java:137) at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77) at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.getApplications(EurekaHttpClientDecorator.java:134) at com.netflix.discovery.DiscoveryClient.getAndStoreFullRegistry(DiscoveryClient.java:1101) at com.netflix.discovery.DiscoveryClient.fetchRegistry(DiscoveryClient.java:1014) at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:441) at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:283) at com.netflix.discovery.DiscoveryClient.<init>(DiscoveryClient.java:279) at org.springframework.cloud.netflix.eureka.CloudEurekaClient.<init>(CloudEurekaClient.java:66) at org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration.eurekaClient(EurekaClientAutoConfiguration.java:295) eureka-server logs from container 2022-10-06 11:46:06.693 INFO [eureka-server,,] 1 --- [ main] e.f.eureka.EurekaServerApplication : Starting EurekaServerApplication using Java 17.0.1 on bf39ca283c65 with PID 1 (/app/classes started by root in /) 2022-10-06 11:46:06.727 INFO [eureka-server,,] 1 --- [ main] e.f.eureka.EurekaServerApplication : The following profiles are active: docker 2022-10-06 11:46:10.568 INFO [eureka-server,,] 1 --- [ main] o.s.cloud.context.scope.GenericScope : BeanFactory id=c87a0e94-d419-31a3-a4bc-1879ab705f9c 2022-10-06 11:46:12.271 INFO [eureka-server,,] 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8761 (http) 2022-10-06 11:46:12.311 INFO [eureka-server,,] 1 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2022-10-06 11:46:12.311 INFO [eureka-server,,] 1 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.55] 2022-10-06 11:46:12.604 INFO [eureka-server,,] 1 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2022-10-06 11:46:12.604 INFO [eureka-server,,] 1 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 5728 ms 2022-10-06 11:46:15.226 INFO [eureka-server,,] 1 --- [ main] c.s.j.s.i.a.WebApplicationImpl : Initiating Jersey application, version 'Jersey: 1.19.4 05/24/2017 03:20 PM' 2022-10-06 11:46:15.401 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson 2022-10-06 11:46:15.402 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson 2022-10-06 11:46:15.755 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml 2022-10-06 11:46:15.755 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml 2022-10-06 11:46:18.003 INFO [eureka-server,,] 1 --- [ main] DiscoveryClientOptionalArgsConfiguration : Eureka HTTP Client uses Jersey 2022-10-06 11:46:18.261 WARN [eureka-server,,] 1 --- [ main] iguration$LoadBalancerCaffeineWarnLogger : Spring Cloud LoadBalancer is currently working with the default cache. You can switch to using Caffeine cache, by adding it and org.springframework.cache.caffeine.CaffeineCacheManager to the classpath. 2022-10-06 11:46:18.274 INFO [eureka-server,,] 1 --- [ main] o.s.c.n.eureka.InstanceInfoFactory : Setting initial instance status as: STARTING 2022-10-06 11:46:18.293 INFO [eureka-server,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Initializing Eureka in region us-east-1 2022-10-06 11:46:18.295 INFO [eureka-server,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Client configured to neither register nor query for data. 2022-10-06 11:46:18.300 INFO [eureka-server,,] 1 --- [ main] com.netflix.discovery.DiscoveryClient : Discovery Client initialized at timestamp 1665056778299 with initial instances count: 0 2022-10-06 11:46:18.396 INFO [eureka-server,,] 1 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initializing ... 2022-10-06 11:46:18.405 INFO [eureka-server,,] 1 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Adding new peer nodes [http://localhost:8761/eureka/] 2022-10-06 11:46:18.857 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON encoding codec LegacyJacksonJson 2022-10-06 11:46:18.857 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using JSON decoding codec LegacyJacksonJson 2022-10-06 11:46:18.857 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML encoding codec XStreamXml 2022-10-06 11:46:18.857 INFO [eureka-server,,] 1 --- [ main] c.n.d.provider.DiscoveryJerseyProvider : Using XML decoding codec XStreamXml 2022-10-06 11:46:19.589 INFO [eureka-server,,] 1 --- [ main] c.n.eureka.cluster.PeerEurekaNodes : Replica node URL: http://localhost:8761/eureka/ 2022-10-06 11:46:19.608 INFO [eureka-server,,] 1 --- [ main] c.n.e.registry.AbstractInstanceRegistry : Finished initializing remote region registries. All known remote regions: [] 2022-10-06 11:46:19.609 INFO [eureka-server,,] 1 --- [ main] c.n.eureka.DefaultEurekaServerContext : Initialized 2022-10-06 11:46:19.855 INFO [eureka-server,,] 1 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 1 endpoint(s) beneath base path '/actuator' 2022-10-06 11:46:19.953 INFO [eureka-server,,] 1 --- [ main] o.s.c.n.e.s.EurekaServiceRegistry : Registering application EUREKA-SERVER with eureka with status UP 2022-10-06 11:46:19.978 INFO [eureka-server,,] 1 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : Setting the eureka configuration.. 2022-10-06 11:46:19.991 INFO [eureka-server,,] 1 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : isAws returned false 2022-10-06 11:46:20.008 INFO [eureka-server,,] 1 --- [ Thread-9] o.s.c.n.e.server.EurekaServerBootstrap : Initialized server context 2022-10-06 11:46:20.008 INFO [eureka-server,,] 1 --- [ Thread-9] c.n.e.r.PeerAwareInstanceRegistryImpl : Got 1 instances from neighboring DS node 2022-10-06 11:46:20.008 INFO [eureka-server,,] 1 --- [ Thread-9] c.n.e.r.PeerAwareInstanceRegistryImpl : Renew threshold is: 1 2022-10-06 11:46:20.008 INFO [eureka-server,,] 1 --- [ Thread-9] c.n.e.r.PeerAwareInstanceRegistryImpl : Changing status to UP 2022-10-06 11:46:20.034 INFO [eureka-server,,] 1 --- [ Thread-9] e.s.EurekaServerInitializerConfiguration : Started Eureka Server 2022-10-06 11:46:20.034 INFO [eureka-server,,] 1 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8761 (http) with context path '' 2022-10-06 11:46:20.035 INFO [eureka-server,,] 1 --- [ main] .s.c.n.e.s.EurekaAutoServiceRegistration : Updating port to 8761 2022-10-06 11:46:20.089 INFO [eureka-server,,] 1 --- [ main] e.f.eureka.EurekaServerApplication : Started EurekaServerApplication in 14.267 seconds (JVM running for 14.702)
Spring boot server all shutdown at the same time for unknown reason
We have a bunch of spring boot servers and they are different code base (but all cloned from the same base) They all went down last night, at slightly different time. When I looked at the log, it didn't say much. Here is the log 2021-08-06 06:22:09.735 INFO 1 --- [ Thread-4] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'threadPoolTaskScheduler' 2021-08-06 06:22:09.747 INFO 1 --- [ Thread-4] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2021-08-06 06:22:09.750 INFO 1 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2021-08-06 06:22:09.761 INFO 1 --- [ Thread-4] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. Here is the log from another project we have 2021-08-06 06:36:39.317 INFO 1 --- [ Thread-3] o.s.s.c.ThreadPoolTaskScheduler : Shutting down ExecutorService 'taskScheduler' 2021-08-06 06:36:39.324 INFO 1 --- [ Thread-3] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 2021-08-06 06:36:39.329 INFO 1 --- [ Thread-3] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default' 2021-08-06 06:36:39.341 INFO 1 --- [ Thread-3] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated... 2021-08-06 06:36:39.354 INFO 1 --- [ Thread-3] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed. What could be the reason and how do I troubleshoot this? The springboot runs inside a docker image, running on ubuntu. The servers were able to be rebooted immediately without issue.
How to configure hikari pool for eager initialization?
I want to configure the Hikari pool to eagerly initialize on application startup and not when first query is issued. As of now spring initializr project shows that hikari pool is provisioned on first query. To reproduce issue - Create spring initializr project with web, jdbc and mysql dependency. Hikari pool is only created after GET request to controller application.properties spring.datasource.url= spring.datasource.driver-class-name= spring.datasource.username= spring.datasource.password= logging.level.com.zaxxer.hikari.HikariConfig=DEBUG spring.datasource.hikari.maximum-pool-size=100 spring.datasource.hikari.minimum-idle=10 spring.datasource.hikari.connection-init-sql=SELECT 1 Controller #RestController public class DemoController { #Autowired private JdbcTemplate template; #GetMapping(value="/request") public String testHikariEagerInitialization() { template.execute("SELECT COUNT(1) FROM trade"); return "Hikari Pool created now!"; } } logs at application startup :: Spring Boot :: (v2.1.6.RELEASE) 2019-07-09 08:36:02.074 INFO 37884 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication on with PID 37884 () 2019-07-09 08:36:02.078 INFO 37884 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default 2019-07-09 08:36:03.132 INFO 37884 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2019-07-09 08:36:03.180 INFO 37884 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2019-07-09 08:36:03.197 INFO 37884 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.21] 2019-07-09 08:36:03.330 INFO 37884 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2019-07-09 08:36:03.330 INFO 37884 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1187 ms 2019-07-09 08:36:03.416 DEBUG 37884 --- [ main] com.zaxxer.hikari.HikariConfig : Driver class com.mysql.jdbc.Driver found in Thread context class loader sun.misc.Launcher$AppClassLoader#764c12b6 2019-07-09 08:36:03.598 INFO 37884 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor' 2019-07-09 08:36:03.832 INFO 37884 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2019-07-09 08:36:03.836 INFO 37884 --- [ main] com.example.demo.DemoApplication : Started DemoApplication in 2.168 seconds (JVM running for 2.99) new logs once GET request is made to controller 2019-07-09 08:39:20.039 INFO 37884 --- [nio-8080-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' 2019-07-09 08:39:20.039 INFO 37884 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet' 2019-07-09 08:39:20.046 INFO 37884 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet : Completed initialization in 7 ms 2019-07-09 08:39:20.071 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : demo-memsql-connection-pool - configuration: 2019-07-09 08:39:20.073 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : allowPoolSuspension.............false 2019-07-09 08:39:20.073 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : autoCommit......................true 2019-07-09 08:39:20.073 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : catalog.........................none 2019-07-09 08:39:20.073 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : connectionInitSql..............."SELECT 1" 2019-07-09 08:39:20.073 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : connectionTestQuery.............none 2019-07-09 08:39:20.073 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : connectionTimeout...............30000 2019-07-09 08:39:20.074 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : dataSource......................none 2019-07-09 08:39:20.074 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : dataSourceClassName.............none 2019-07-09 08:39:20.074 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : dataSourceJNDI..................none 2019-07-09 08:39:20.074 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>} 2019-07-09 08:39:20.075 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : driverClassName................."com.mysql.jdbc.Driver" 2019-07-09 08:39:20.075 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : healthCheckProperties...........{} 2019-07-09 08:39:20.075 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : healthCheckRegistry.............none 2019-07-09 08:39:20.075 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : idleTimeout.....................600000 2019-07-09 08:39:20.075 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : initializationFailTimeout.......1 2019-07-09 08:39:20.075 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : isolateInternalQueries..........false 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : jdbcUrl.........................jdbc:mysql:// 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : leakDetectionThreshold..........0 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : maxLifetime.....................1800000 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : maximumPoolSize.................100 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : metricRegistry..................none 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : metricsTrackerFactory...........none 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : minimumIdle.....................10 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : password........................<masked> 2019-07-09 08:39:20.076 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : poolName........................"demo-memsql-connection-pool" 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : readOnly........................false 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : registerMbeans..................true 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : scheduledExecutor...............none 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : schema..........................none 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : threadFactory...................internal 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : transactionIsolation............default 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : username........................"" 2019-07-09 08:39:20.077 DEBUG 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariConfig : validationTimeout...............5000 2019-07-09 08:39:20.077 INFO 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariDataSource : demo-memsql-connection-pool - Starting... 2019-07-09 08:39:20.466 INFO 37884 --- [nio-8080-exec-1] com.zaxxer.hikari.HikariDataSource : demo-memsql-connection-pool - Start completed.
You can use an ApplicationLoader and get a connection at startup: #Component public class HikariLoader implements ApplicationRunner { private final HikariDataSource hikariDataSource; public HikariLoader(HikariDataSource hikariDataSource) { this.hikariDataSource = hikariDataSource; } #Autowired public void run(ApplicationArguments args) throws SQLException { hikariDataSource.getConnection(); } } This works well with the code given in the question and was tested with Spring Boot 2.1.6.
I know this is an old question but I just ran into the same issue. I took a similar approach to #Ortomala Lokni - but instead of adding a whole new loader class I just added a #PostConstruct method to my controller to warm the pool as the controller starts up. I think this is a little more concise and will accomplish the same thing. For your example it would look like this: #RestController public class DemoController { #Autowired private JdbcTemplate template; #GetMapping(value="/request") public String testHikariEagerInitialization() { ... } #PostConstruct private void warmConnectionPool() { template.getDataSource().getConnection() //starts the pool } } I wish there was a hikari pool configuration property that would accomplish the same thing, but I wasn't able to find one!
spring initialization hangs for few min
When starting Spring it will get hang for like 5 min If you look at the log WebApplicationContext: initialization happens in 16:36 the next message is Initialized JPA EntityManagerFactory happens in 16:41 almost 5 min later What could be the issue? Thank you! 2019-05-09 16:36:59.619 INFO 18120 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 10419 ms 2019-05-09 16:41:18.196 INFO 18120 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'portal' 2019-05-09 16:41:18.362 INFO 18120 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2019-05-09 16:41:26.759 INFO 18120 --- [ restartedMain] s.s.l.DefaultSpringSecurityContextSource : URL 'ldap://ldap01:389', root DN is '' 2019-05-09 16:41:26.863 INFO 18120 --- [ restartedMain] .s.s.l.u.DefaultLdapAuthoritiesPopulator : groupSearchBase is empty. Searches will be performed from the context source base 2019-05-09 16:41:27.128 DEBUG 18120 --- [ restartedMain] com.xerox.printerfarm.config.SecurityConfig : secureEndPoints => /printers/**,/employees/user/** 2019-05-09 16:41:27.984 INFO 18120 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: any request, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#6935ce05, org.springframework.security.web.context.SecurityContextPersistenceFilter#5c58f813, org.springframework.security.web.header.HeaderWriterFilter#54fe23e9, org.springframework.security.web.authentication.logout.LogoutFilter#1f81a1d8, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#43759aa7, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#40017880, org.springframework.security.web.authentication.ui.DefaultLogoutPageGeneratingFilter#60c590e1, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#64a8529a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#4cd90a9, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#6dd6807b, org.springframework.security.web.session.SessionManagementFilter#b218290, org.springframework.security.web.access.ExceptionTranslationFilter#b52b511, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#6d4bb1] 2019-05-09 16:41:28.354 INFO 18120 --- [ restartedMai UPDATE with some debug code from logger.org.springframework set to debug 2019-05-14 11:45:16.891 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'entityManagerFactoryBuilder' 2019-05-14 11:45:16.891 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'entityManagerFactory' via factory method to bean named 'dataSource' 2019-05-14 11:45:16.995 DEBUG 22824 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'portal' 2019-05-14 11:45:18.665 DEBUG 22824 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:#devserv1:1521/DEV01SID] 2019-05-14 11:45:24.169 DEBUG 22824 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:#devserv1:1521/DEV01SID] 2019-05-14 11:45:24.703 DEBUG 22824 --- [ restartedMain] o.s.j.d.DriverManagerDataSource : Creating new JDBC DriverManager Connection to [jdbc:oracle:thin:#devserv1:1521/DEV01SID] 2019-05-14 11:46:14.229 DEBUG 22824 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1557848774228 sessioncount 0 2019-05-14 11:46:14.229 DEBUG 22824 --- [alina-utility-2] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 1 expired sessions: 0 ---- 1 min here 2019-05-14 11:47:14.240 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1557848834240 sessioncount 0 2019-05-14 11:47:14.240 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0 ---- 1 min here 2019-05-14 11:48:14.246 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : Start expire sessions StandardManager at 1557848894246 sessioncount 0 2019-05-14 11:48:14.246 DEBUG 22824 --- [alina-utility-1] org.apache.catalina.session.ManagerBase : End expire sessions StandardManager processingTime 0 expired sessions: 0 ---- 1 min here 2019-05-14 11:49:13.998 INFO 22824 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'portal' 2019-05-14 11:49:14.009 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'delegatingApplicationListener' 2019-05-14 11:49:14.018 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'liveReloadServerEventListener' 2019-05-14 11:49:14.019 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'org.springframework.boot.devtools.autoconfigure.LocalDevToolsAutoConfiguration$LiveReloadConfiguration' 2019-05-14 11:49:14.031 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'optionalLiveReloadServer' 2019-05-14 11:49:14.035 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Creating shared instance of singleton bean 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties' 2019-05-14 11:49:14.043 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'liveReloadServer' via factory method to bean named 'spring.devtools-org.springframework.boot.devtools.autoconfigure.DevToolsProperties' 2019-05-14 11:49:14.071 DEBUG 22824 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Autowiring by type from bean name 'optionalLiveReloadServer' via factory method to bean named 'liveReloadServer' 2019-05-14 11:49:14.083 DEBUG 22824 --- [ restartedMain] o.s.b.d.livereload.LiveReloadServer : Starting live reload server on port 35729
Spring boot - how to override the default username and password in spring security
I have a spring boot application and i am trying to implement the spring security to override the default username and password generated by spring .but its not working. spring still using the default user credentials. #EnableWebSecurity #Configuration public class WebSecurityConfigurtion extends WebSecurityConfigurerAdapter { #Override protected void configure(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("demo").password("demo").roles("USER").and().withUser("admin") .password("admin").roles("USER", "ADMIN"); } #Override protected void configure(HttpSecurity http) throws Exception { http.authorizeRequests().anyRequest().authenticated().and().httpBasic(); } and this is my main spring boot class #SpringBootApplication(exclude = { DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class ,SecurityAutoConfiguration.class}) #EnableAsync #EntityScan({ "com.demo.entity" }) #EnableJpaRepositories(basePackages = {"com.demo.repositories"}) #ComponentScan({ "com.demo.controller", "com.demo.service" }) #Import({SwaggerConfig.class}) public class UdeManagerServiceApplication extends SpringBootServletInitializer { #Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(UdeManagerServiceApplication.class); } public static void main(String[] args) { SpringApplication.run(UdeManagerServiceApplication.class, args); } This is the logs, and it shows the generated password 22:26:48.537 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Included patterns for restart : [] 22:26:48.540 [main] DEBUG org.springframework.boot.devtools.settings.DevToolsSettings - Excluded patterns for restart : [/spring-boot-actuator/target/classes/, /spring-boot-devtools/target/classes/, /spring-boot/target/classes/, /spring-boot-starter-[\w-]+/, /spring-boot-autoconfigure/target/classes/, /spring-boot-starter/target/classes/] 22:26:48.540 [main] DEBUG org.springframework.boot.devtools.restart.ChangeableUrls - Matching URLs for reloading : [file:/C:/Work/Spring/UdeManagerService/target/classes/] 2018-10-18 22:26:48.797 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'configurationProperties' with highest search precedence . ____ _ __ _ _ /\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \ ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \ \\/ ___)| |_)| | | | | || (_| | ) ) ) ) ' |____| .__|_| |_|_| |_\__, | / / / / =========|_|==============|___/=/_/_/_/ :: Spring Boot :: (v2.0.4.RELEASE) 2018-10-18 22:26:49.218 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'servletConfigInitParams' with lowest search precedence 2018-10-18 22:26:49.219 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'servletContextInitParams' with lowest search precedence 2018-10-18 22:26:49.220 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'systemProperties' with lowest search precedence 2018-10-18 22:26:49.221 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'systemEnvironment' with lowest search precedence 2018-10-18 22:26:49.222 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Initialized StandardServletEnvironment with PropertySources [StubPropertySource {name='servletConfigInitParams'}, StubPropertySource {name='servletContextInitParams'}, MapPropertySource {name='systemProperties'}, SystemEnvironmentPropertySource {name='systemEnvironment'}] 2018-10-18 22:26:49.967 INFO 7652 --- [ restartedMain] c.c.U.UdeManagerServiceApplication : Starting UdeManagerServiceApplication on TRV-LT-ANSAR with PID 7652 (C:\Work\Spring\UdeManagerService\target\classes started by Ansar.Samad in C:\Work\Spring\UdeManagerService) 2018-10-18 22:26:49.973 DEBUG 7652 --- [ restartedMain] c.c.U.UdeManagerServiceApplication : Running with Spring Boot v2.0.4.RELEASE, Spring v5.0.8.RELEASE 2018-10-18 22:26:49.976 INFO 7652 --- [ restartedMain] c.c.U.UdeManagerServiceApplication : No active profile set, falling back to default profiles: default 2018-10-18 22:26:50.614 INFO 7652 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#23daa694: startup date [Thu Oct 18 22:26:50 IST 2018]; root of context hierarchy 2018-10-18 22:26:53.258 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Removing PropertySource 'defaultProperties' 2018-10-18 22:26:53.428 INFO 7652 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$82d409fb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2018-10-18 22:26:53.936 INFO 7652 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2018-10-18 22:26:53.959 INFO 7652 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2018-10-18 22:26:53.960 INFO 7652 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.32 2018-10-18 22:26:53.966 INFO 7652 --- [ost-startStop-1] 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_162\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:/Program Files (x86)/Java/jre1.8.0_181/bin/client;C:/Program Files (x86)/Java/jre1.8.0_181/bin;C:/Program Files (x86)/Java/jre1.8.0_181/lib/i386;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin;C:\phython3.6\Scripts\;C:\phython3.6\;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jre1.8.0_131\bin;C:\cuia\bat;C:\apache-maven-3.5.0-bin\apache-maven-3.5.0\bin;JAVA_HOME;SPRING_HOME;C:\Program Files (x86)\Symantec\VIP Access Client\;C:\phython3.6;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;TESTNG_HOME;C:\TestNg\testng-6.8.jar;C:\python-3.6.5\Scripts;C:\python-3.6.5;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\nodejs\;;C:\Program Files\Microsoft VS Code\bin;C:\Users\Ansar.Samad\AppData\Local\Yarn\bin;C:\Users\Ansar.Samad\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Ansar.Samad\AppData\Roaming\npm;C:\spring-tool-suite-3.9.5.RELEASE-e4.8.0-win32\sts-bundle\sts-3.9.5.RELEASE;;.] 2018-10-18 22:26:54.081 INFO 7652 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2018-10-18 22:26:54.082 DEBUG 7652 --- [ost-startStop-1] o.s.web.context.ContextLoader : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT] 2018-10-18 22:26:54.082 INFO 7652 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 3468 ms 2018-10-18 22:26:54.192 INFO 7652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2018-10-18 22:26:54.193 INFO 7652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2018-10-18 22:26:54.193 INFO 7652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2018-10-18 22:26:54.193 INFO 7652 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2018-10-18 22:26:54.194 INFO 7652 --- [ost-startStop-1] .s.DelegatingFilterProxyRegistrationBean : Mapping filter: 'springSecurityFilterChain' to: [/*] 2018-10-18 22:26:54.194 INFO 7652 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2018-10-18 22:26:54.274 DEBUG 7652 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Replacing PropertySource 'servletContextInitParams' with 'servletContextInitParams' 2018-10-18 22:26:54.308 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : Driver class com.mysql.jdbc.Driver found in Thread context class loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader#4e843ef9 2018-10-18 22:26:54.407 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : HikariPool-1 - configuration: 2018-10-18 22:26:54.409 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : allowPoolSuspension.............false 2018-10-18 22:26:54.409 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : autoCommit......................true 2018-10-18 22:26:54.409 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : catalog.........................none 2018-10-18 22:26:54.409 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : connectionInitSql...............none 2018-10-18 22:26:54.409 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : connectionTestQuery.............none 2018-10-18 22:26:54.410 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : connectionTimeout...............30000 2018-10-18 22:26:54.410 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : dataSource......................none 2018-10-18 22:26:54.410 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : dataSourceClassName.............none 2018-10-18 22:26:54.410 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : dataSourceJNDI..................none 2018-10-18 22:26:54.411 DEBUG 7652 --- [ restartedMain] com.zaxxer.hikari.HikariConfig : dataSourceProperties............{password=<masked>} 2018-10-18 22:22018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationAuthReader': no URL paths identified 2018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationHiddenReader': no URL paths identified 2018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationHttpMethodReader': no URL paths identified 2018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationImplicitParameterReader': no URL paths identified 2018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationImplicitParametersReader': no URL paths identified 2018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationNicknameIntoUniqueIdReader': no URL paths identified 2018-10-18 22:35:45.240 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'operationNotesReader': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'systemProperties': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'systemEnvironment': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'org.springframework.context.annotation.ConfigurationClassPostProcessor.importRegistry': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'messageSource': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'applicationEventMulticaster': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'servletContext': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'contextParameters': no URL paths identified 2018-10-18 22:35:45.256 DEBUG 6720 --- [ restartedMain] o.s.w.s.h.BeanNameUrlHandlerMapping : Rejected bean name 'contextAttributes': no URL paths identified 2018-10-18 22:35:45.256 INFO 6720 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-10-18 22:35:45.256 INFO 6720 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2018-10-18 22:35:45.271 DEBUG 6720 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : Looking for exception mappings: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#275b060b: startup date [Thu Oct 18 22:35:35 IST 2018]; root of context hierarchy 2018-10-18 22:35:45.599 INFO 6720 --- [ restartedMain] .s.s.UserDetailsServiceAutoConfiguration : Using generated security password: e67dca07-3bc3-49e2-bc33-84c9643ef09a 2018-10-18 22:35:45.740 INFO 6720 --- [ restartedMain] o.s.s.web.DefaultSecurityFilterChain : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher#1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter#6abf32c0, org.springframework.security.web.context.SecurityContextPersistenceFilter#b2b202e, org.springframework.security.web.header.HeaderWriterFilter#23ff67f5, org.springframework.security.web.csrf.CsrfFilter#a493c40, org.springframework.security.web.authentication.logout.LogoutFilter#776a660, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#334ce4e9, org.springframework.security.web.authentication.ui.DefaultLoginPageGeneratingFilter#1f4c6b47, org.springframework.security.web.authentication.www.BasicAuthenticationFilter#4a4c14a3, org.springframework.security.web.savedrequest.RequestCacheAwareFilter#7793ba1a, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter#4edda6d8, org.springframework.security.web.authentication.AnonymousAuthenticationFilter#3e492163, org.springframework.security.web.session.SessionManagementFilter#68661010, org.springframework.security.web.access.ExceptionTranslationFilter#6920b121, org.springframework.security.web.access.intercept.FilterSecurityInterceptor#35279a68] 2018-10-18 22:35:45.836 INFO 6720 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2018-10-18 22:35:45.867 INFO 6720 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2018-10-18 22:35:45.867 INFO 6720 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure 2018-10-18 22:35:45.883 INFO 6720 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource] 2018-10-18 22:35:45.883 INFO 6720 --- [ restartedMain] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647 2018-10-18 22:35:45.883 INFO 6720 --- [ restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed 2018-10-18 22:35:45.899 INFO 6720 --- [ restartedMain] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s) 2018-10-18 22:35:45.914 INFO 6720 --- [ restartedMain] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references 2018-10-18 22:35:46.086 INFO 6720 --- [ restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: testUsingPOST_1 2018-10-18 22:35:46.101 INFO 6720 --- [ restartedMain] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: getDataUsingGET_1 2018-10-18 22:35:46.117 DEBUG 6720 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Looking for resource handler mappings 2018-10-18 22:35:46.117 DEBUG 6720 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**/favicon.ico", locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/], class path resource []], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#3914bc92] 2018-10-18 22:35:46.117 DEBUG 6720 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/webjars/**", locations=[class path resource [META-INF/resources/webjars/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#3dc6f1f0] 2018-10-18 22:35:46.117 DEBUG 6720 --- [ restartedMain] o.s.w.s.resource.ResourceUrlProvider : Found resource handler mapping: URL pattern="/**", locations=[class path resource [META-INF/resources/], class path resource [resources/], class path resource [static/], class path resource [public/], ServletContext resource [/]], resolvers=[org.springframework.web.servlet.resource.PathResourceResolver#315362d4] 2018-10-18 22:35:47.196 DEBUG 6720 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.jdbc.JDBC4Connection#edd709c 2018-10-18 22:35:49.180 INFO 6720 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2018-10-18 22:35:49.180 DEBUG 6720 --- [ restartedMain] o.s.w.c.s.StandardServletEnvironment : Adding PropertySource 'server.ports' with highest search precedence 2018-10-18 22:35:49.180 INFO 6720 --- [ restartedMain] c.c.U.UdeManagerServiceApplication : Started UdeManagerServiceApplication in 14.132 seconds (JVM running for 14.884) 2018-10-18 22:35:50.929 DEBUG 6720 --- [onnection adder] com.zaxxer.hikari.pool.HikariPool : HikariPool-1 - Added connection com.mysql.jdbc.JDBC4Connection#7a5e8413
In your application.properties file add this code spring.security.user.name = root -- this is your username spring.security.user.password = root -- this is your password spring.security.user.roles = user --this is your role
You need to register a UserDetailsService bean. In this case, just expose the InMemoryUserDetailsManager as a bean in your WebSecurityConfiguration.class, like this: // expose the UserDetailsService as a bean #Bean #Override public UserDetailsService userDetailsServiceBean() throws Exception { return super.userDetailsServiceBean(); }
This can be done using following properties on application.properties or application.yaml file. spring.security.user.name spring.security.user.password spring.security.user.roles Take a look at this.
Issue fixed by adding the config package where the security classes are availble into the component scanning of the main class.