Spring boot application crashing on PCF (Pivotal Cloud Foundry) cloud - spring

I have deployed my spring boot application on PCF (Pivotal Cloud Foundry) cloud and it was running fine since last many days but suddenly from last 24 hours, this application is started crashing in every few minutes.
And getting below errors
[trade-data-service,,,] 15 --- [main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reactiveHealthIndicatorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/LegacyHealthEndpointCompatibilityConfiguration$LegacyReactiveHealthEndpointCompatibilityConfiguration.class]: Unsatisfied dependency expressed through method 'reactiveHealthIndicatorRegistry' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'reactiveHealthContributorRegistry' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/ReactiveHealthEndpointConfiguration.class]: Unsatisfied dependency expressed through method 'reactiveHealthContributorRegistry' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'discoveryCompositeHealthContributor' defined in class path resource [org/springframework/cloud/client/CommonsClientAutoConfiguration$DiscoveryLoadBalancerConfiguration.class]: Unsatisfied dependency expressed through method 'discoveryCompositeHealthContributor' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'eurekaHealthIndicator' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration$EurekaHealthIndicatorConfiguration.class]: Unsatisfied dependency expressed through method 'eurekaHealthIndicator' parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eurekaInstanceConfigBean' defined in class path resource [org/springframework/cloud/netflix/eureka/EurekaClientAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.cloud.netflix.eureka.EurekaInstanceConfigBean]: Factory method 'eurekaInstanceConfigBean' threw exception; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'vcap.application.uris[0]' in value "${vcap.application.uris[0]}"
[trade-data-service,,,] 15 --- [main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor' 
[trade-data-service,,,] 15 --- [main] o.apache.catalina.core.StandardService : Stopping service [Tomcat] 
If I check health of application using /actuator/health then it return application status is UP.
What could be the reason ?
Please help

Related

Java Springboot Issue Configuration Manager is null (Intellij)

I am getting unusal issue
ERROR TomcatStarter Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException.
Below is the stack trace.
ERROR TomcatStarter Error starting Tomcat context. Exception: org.springframework.beans.factory.UnsatisfiedDependencyException. Message: Error creating bean with name 'jwtRequestFilter': Unsatisfied dependency expressed through field 'passwordEncoder'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'webSecurityConfig': Unsatisfied dependency expressed through method 'setContentNegotationStrategy' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'swaggerWebMvcConfigurer' defined in class path resource [org/springdoc/webmvc/ui/SwaggerConfig.class]: Unsatisfied dependency expressed through method 'swaggerWebMvcConfigurer' parameter 1; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'indexPageTransformer' defined in class path resource [org/springdoc/webmvc/ui/SwaggerConfig.class]: Unsatisfied dependency expressed through method 'indexPageTransformer' parameter 3; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'swaggerWelcome': Injection of autowired dependencies failed; nested exception is {"prefix": "PLR", "code": "CCM-6117", "description": "Configuration Manager is null."}
Feb 03, 2023 7:14:57 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service [Tomcat]
19:14:58.065 [main] INFO com.walmart.platform.scm.client.impl.SCMImpl - Initiating SCM shutdown
ERROR SpringApplication Application run failed
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:163)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:577)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:740)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:415)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1301)
at com.samsclub.lumos.LumosApplication.main(LumosApplication.java:39)
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142)
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104)
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:478)
at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:182)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:160)
This issue only comes when I run in local but when am package and run, it works fine!

IllegalAccessError after moving from spring boot 2.4.6 to 2.5.4

I am trying to upgrade from spring boot 2.4.6 to 2.5.4 and have started receiving following error
Error starting ApplicationContext. To display the conditions report
re-run your application with 'debug' enabled. 2021-09-28 14:10:37
[main] ERROR o.s.boot.SpringApplication - Application run failed
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'supplierInitializer' defined in class path
resource
[org/springframework/cloud/stream/function/FunctionConfiguration.class]:
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name
'inMemorySwaggerResourcesProvider_integrationflow.org.springframework.integration.config.SourcePollingChannelAdapterFactoryBean#0':
Invocation of init method failed; nested exception is
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'integrationGlobalProperties' defined in class
path resource
[org/springframework/boot/autoconfigure/integration/IntegrationAutoConfiguration.class]:
Bean instantiation via factory method failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to
instantiate
[org.springframework.integration.context.IntegrationProperties]:
Factory method 'integrationGlobalProperties' threw exception; nested
exception is java.lang.IllegalAccessError: class
org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
tried to access private method 'void
org.springframework.integration.context.IntegrationProperties.()'
(org.springframework.boot.autoconfigure.integration.IntegrationAutoConfiguration
and org.springframework.integration.context.IntegrationProperties are
in unnamed module of loader 'app')
Not able to understand what has changed in spring boot 2.5.X , although upgrading till version 2.4.11 works fine.
I guess you have an old version of spring-integration-core library. Delete all the folders under .m2/repository/org/springframework/integration That should fix it.

Starting spring boot application, results in java.lang.RuntimeException

I'm implementing secret manager for rds mysql database for password. It's a spring boot application. While starting up, application is throwing the following error.
WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext.refresh - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is java.lang.RuntimeException: Driver com.mysql.cj.jdbc.Driver claims to not accept jdbcUrl, jdbc-secretsmanager:mysql://dev-transaction-summary-db.cluster-csuuxb898zxl.us-east-1.rds.amazonaws.com:3306/transaction_summary?serverTimezone=UTC&useSSL=true&serverSslCert=/opt/rds-certs/rds-combined-ca-bundle.pem
INFO o.a.catalina.core.StandardService.log - Stopping service [Tomcat]
[localhost-startStop-1] WARN o.a.c.loader.WebappClassLoaderBase.log - The web application [ROOT] appears to have started a thread named [java-sdk-http-connection-reaper] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Thread.sleep(Native Method)

Flyway integration(Enterprise Version) in Spring Boot problem

Hello i got this error when i use flyway enterprise in my springboot project:
16:27:46 WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.scheduling.annotation.ProxyAsyncConfiguration': Unsatisfied dependency expressed through method 'setConfigurers' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'springAsyncConfig': Unsatisfied dependency expressed through field 'customAsyncExceptionHandler'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'customAsyncExceptionHandler': Unsatisfied dependency expressed through field 'importHistoryRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'importHistoryRepository': Cannot create inner bean '(inner bean)#31db34da' of type [org.springframework.orm.jpa.SharedEntityManagerCreator] while setting bean property 'entityManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#31db34da': Cannot resolve reference to bean 'entityManagerFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration$FlywayConfiguration': Unexpected exception during bean creation; nested exception is java.lang.TypeNotPresentException: Type org.flywaydb.core.api.callback.FlywayCallback not present
Here is my pom.xml file:
<dependency>
<groupId>org.flywaydb.enterprise</groupId>
<artifactId>flyway-core</artifactId>
<version>6.0.3</version>
</dependency>
Related to this Issue Flyway 6.x.x is not compatible with Spring Boot < 2.2.0.
So you got 2 Choices:
Update Spring Boot to >= 2.2.0
Use flyway 5.x.x
Hope this helps

Datasource instanciation error with actuator

I'm using Spring Boot 2.0.6.RELEASE. My application uses the Oracle jdbc driver and works nice with this kind of configuration:
spring.datasource.url=jdbc:oracle:thin:#my-data-server/database
spring.datasource.username=username
spring.datasource.password=pwd
spring.datasource.hikari.maximum-pool-size=10
spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
But... When adding actuator, the application fails to start. It seems that the /health endpoint causes this problem (maybe because it is the first bean which needs a datasource?).
The problem is that the datasource can't be instanciate... But it works well without actuator.
Any idea ?
I was wondering if DataSourceHealthIndicatorAutoConfiguration could be the source of the problem: this class has the anotation #AutoConfigureAfter(DataSourceAutoConfiguration.class)... But it seems that Hikari doesn't use this autoconfig class, does it? I see org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Hikari in the stack trace but not DataSourceAutoConfiguration...
**UPDATE : ** I'm using FlyWay
**UPDATE 2 **, This may be a hint: https://github.com/spring-projects/spring-boot/issues/14687
Here is the full stacktrace:
2019-02-08 17:33:38.359 ERROR 14652 --- [ost-startStop-1]
o.s.b.web.embedded.tomcat.TomcatStarter : Error starting Tomcat context. Exception: org.springframework.beans.factory.BeanCreationException. Message: Error creating bean with name 'servletEndpointRegistrar' defined in class path resource [org/springframework/boot/actuate/autoconfigure/endpoint/web/ServletEndpointManagementContextConfiguration$WebMvcServletEndpointManagementContextConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.endpoint.web.ServletEndpointRegistrar]: Factory method 'servletEndpointRegistrar' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'healthEndpoint' defined in class path resource [org/springframework/boot/actuate/autoconfigure/health/HealthEndpointConfiguration.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.health.HealthEndpoint]: Factory method 'healthEndpoint' threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfiguration': Bean instantiation via constructor failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [org.springframework.boot.actuate.autoconfigure.jdbc.DataSourceHealthIndicatorAutoConfiguration$$EnhancerBySpringCGLIB$$8065d973]: Constructor threw exception;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Post-processing of FactoryBean's singleton object failed;
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.dataSource' defined in class path resource [org/springframework/boot/autoconfigure/jdbc/DataSourceConfiguration$Hikari.class]: Bean instantiation via factory method failed;
nested exception is org.springframework.beans.BeanInstantiationException:
Failed to instantiate [com.zaxxer.hikari.HikariDataSource]: Factory method 'dataSource' threw exception;
nested exception is org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Failed to determine a suitable driver class
2019-02-08 17:33:38.381 INFO 14652 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-02-08 17:33:38.416 WARN 14652 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [ROOT] appears to have started a thread named [spring.cloud.inetutils] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
sun.misc.Unsafe.park(Native Method)
java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:2039)
java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:442)
java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1074)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1134)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
java.lang.Thread.run(Thread.java:748)
2019-02-08 17:33:38.419 WARN 14652 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2019-02-08 17:33:38.437 INFO 14652 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-02-08 17:33:38.445 ERROR 14652 --- [ restartedMain] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Failed to configure a DataSource: 'url' attribute is not specified and no embedded datasource could be configured.
Reason: Failed to determine a suitable driver class
Action:
Consider the following:
If you want an embedded database (H2, HSQL or Derby), please put it on the classpath.
If you have database settings to be loaded from a particular profile you may need to activate it (the profiles dev are currently active).
Process finished with exit code 0

Resources