SpringBoot + RabbitMQ throwing error : java.net.ConnectException: Connection refused - java

I have hosted a multimodule project on heroku and receiving the following error when trying to run my Spring Boot Application.
2018-06-13T05:34:47.611296+00:00 app[web.1]: 2018-06-13 05:34:47.611 INFO 4 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'rabbitConnectionFactory' has been autodetected for JMX exposure
2018-06-13T05:34:47.617422+00:00 app[web.1]: 2018-06-13 05:34:47.617 INFO 4 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'rabbitConnectionFactory': registering with JMX server as MBean [org.springframework.amqp.rabbit.connection:name=rabbitConnectionFactory,type=CachingConnectionFactory]
2018-06-13T05:34:47.646470+00:00 app[web.1]: 2018-06-13 05:34:47.646 INFO 4 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-06-13T05:34:47.660578+00:00 app[web.1]: 2018-06-13 05:34:47.660 INFO 4 --- [ container-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:34:47.680639+00:00 app[web.1]: 2018-06-13 05:34:47.679 ERROR 4 --- [ container-1] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
2018-06-13T05:34:47.680646+00:00 app[web.1]:
2018-06-13T05:34:47.680648+00:00 app[web.1]: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:34:47.680650+00:00 app[web.1]: at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:34:47.680651+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:476) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:34:47.680656+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:614) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:34:47.680658+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:240) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:34:47.680659+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1797) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
The issue I see is, it is trying to connect some localhost whereas I have my addon CloudAMQP
Little Lemur added in heroku and I have added these to my both Application.yml file:
spring:
profiles: heroku
mvc:
async:
request-timeout: 3600000
rabbitmq:
addresses: amqp://****:*****#puma.rmq.cloudamqp.com/uyjgxslh
host: puma.rmq.cloudamqp.com
port: 1883
username: ****:****
password: *****
In my webModule I have this code:
#SpringBootApplication
public class SpringBootHerokuExampleApplication {
public final static String PDF_MERGE_QUEUE= "pdf-merge-queue";
#Bean
Queue queue(){
return new Queue(PDF_MERGE_QUEUE, false);
}
#Bean
TopicExchange exchange(){
return new TopicExchange("pdf-nerge-exchange");
}
#Bean
Binding binding(Queue queue, TopicExchange topicExchange){
return BindingBuilder.bind(queue).to(topicExchange).with(PDF_MERGE_QUEUE);
}
#Bean
SimpleMessageListenerContainer container(ConnectionFactory connectionFactory,
MessageListenerAdapter listenerAdapter){
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueueNames(PDF_MERGE_QUEUE);
container.setMessageListener(listenerAdapter);
return container;
}
#Bean
MessageListenerAdapter listenerAdapter(RabbitMQListener rabbitMQListener){
return new MessageListenerAdapter(rabbitMQListener, "receiveMessage");
}
public static void main(String[] args) {
SpringApplication.run(SpringBootHerokuExampleApplication.class, args);
}
}
and in my worker module main method:
public class SpringBootHerokuExampleApplication {
public final static String PDF_MERGE_QUEUE= "pdf-merge-queue";
public static void main(String[] args) {
SpringApplication.run(SpringBootHerokuExampleApplication.class, args);
}
}
Please find below some more stack trace from Heroku logs :
handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2018-06-13T05:54:13.871350+00:00 app[worker.1]: 2018-06-13 05:54:13.870 INFO 4 --- [ main] o.s.b.a.e.web.EndpointLinksResolver : Exposing 2 endpoint(s) beneath base path '/actuator'
2018-06-13T05:54:13.897860+00:00 app[worker.1]: 2018-06-13 05:54:13.897 INFO 4 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-06-13T05:54:13.899632+00:00 app[worker.1]: 2018-06-13 05:54:13.899 INFO 4 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,java.util.Map<java.lang.String, java.lang.String>)
2018-06-13T05:54:13.901591+00:00 app[worker.1]: 2018-06-13 05:54:13.901 INFO 4 --- [ main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected java.util.Map<java.lang.String, java.util.Map<java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-06-13T05:54:14.128560+00:00 app[worker.1]: 2018-06-13 05:54:14.128 INFO 4 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup
2018-06-13T05:54:14.145677+00:00 app[worker.1]: 2018-06-13 05:54:14.145 INFO 4 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'rabbitConnectionFactory' has been autodetected for JMX exposure
2018-06-13T05:54:14.154055+00:00 app[worker.1]: 2018-06-13 05:54:14.153 INFO 4 --- [ main] o.s.j.e.a.AnnotationMBeanExporter : Located managed bean 'rabbitConnectionFactory': registering with JMX server as MBean [org.springframework.amqp.rabbit.connection:name=rabbitConnectionFactory,type=CachingConnectionFactory]
2018-06-13T05:54:14.199050+00:00 app[worker.1]: 2018-06-13 05:54:14.197 INFO 4 --- [ main] o.s.c.support.DefaultLifecycleProcessor : Starting beans in phase 2147483647
2018-06-13T05:54:14.230846+00:00 app[worker.1]: 2018-06-13 05:54:14.230 INFO 4 --- [cTaskExecutor-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:54:14.425996+00:00 app[worker.1]: 2018-06-13 05:54:14.425 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2018-06-13T05:54:14.437981+00:00 app[worker.1]: 2018-06-13 05:54:14.435 INFO 4 --- [ main] o.e.SpringBootHerokuExampleApplication : Started SpringBootHerokuExampleApplication in 13.198 seconds (JVM running for 14.523)
2018-06-13T05:54:14.969935+00:00 app[web.1]: 2018-06-13 05:54:14.969 WARN 4 --- [ container-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:14.970343+00:00 app[web.1]: 2018-06-13 05:54:14.970 INFO 4 --- [ container-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#362d89d0: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-06-13T05:54:14.971125+00:00 app[web.1]: 2018-06-13 05:54:14.971 INFO 4 --- [ container-3] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:54:14.971946+00:00 app[web.1]: 2018-06-13 05:54:14.971 ERROR 4 --- [ container-3] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
2018-06-13T05:54:14.971948+00:00 app[web.1]:
2018-06-13T05:54:14.971951+00:00 app[web.1]: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:14.971952+00:00 app[web.1]: at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971953+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:476) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971956+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:614) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971957+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:240) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971958+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1797) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971959+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1771) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971960+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1752) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971961+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:338) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971962+00:00 app[web.1]: at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1604) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971964+00:00 app[web.1]: at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:963) [spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971965+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171-heroku]
2018-06-13T05:54:14.971967+00:00 app[web.1]: Caused by: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:14.971969+00:00 app[web.1]: at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:14.971971+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:14.971972+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:14.971973+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:14.971974+00:00 app[web.1]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:14.971975+00:00 app[web.1]: at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:14.971976+00:00 app[web.1]: at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:14.971977+00:00 app[web.1]: at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:955) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:14.971978+00:00 app[web.1]: at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:907) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:14.971979+00:00 app[web.1]: at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:847) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:14.971980+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:449) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:14.971981+00:00 app[web.1]: ... 9 common frames omitted
2018-06-13T05:54:14.971982+00:00 app[web.1]:
2018-06-13T05:54:14.972042+00:00 app[web.1]: 2018-06-13 05:54:14.971 INFO 4 --- [ container-3] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:54:19.262272+00:00 app[worker.1]: 2018-06-13 05:54:19.261 WARN 4 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:19.264406+00:00 app[worker.1]: 2018-06-13 05:54:19.264 INFO 4 --- [cTaskExecutor-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#793be5ca: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-06-13T05:54:19.272605+00:00 app[worker.1]: 2018-06-13 05:54:19.272 INFO 4 --- [cTaskExecutor-2] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:54:19.976366+00:00 app[web.1]: 2018-06-13 05:54:19.976 WARN 4 --- [ container-3] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:19.976491+00:00 app[web.1]: 2018-06-13 05:54:19.976 INFO 4 --- [ container-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#42d37ed7: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-06-13T05:54:19.977274+00:00 app[web.1]: 2018-06-13 05:54:19.977 INFO 4 --- [ container-4] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:54:19.978248+00:00 app[web.1]: 2018-06-13 05:54:19.978 ERROR 4 --- [ container-4] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
2018-06-13T05:54:19.978251+00:00 app[web.1]:
2018-06-13T05:54:19.978252+00:00 app[web.1]: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:19.978253+00:00 app[web.1]: at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:62) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978255+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:476) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978256+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:614) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978257+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:240) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978258+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:1797) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978259+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1771) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978260+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:1752) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978261+00:00 app[web.1]: at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:338) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978263+00:00 app[web.1]: at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1604) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978264+00:00 app[web.1]: at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:963) [spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978265+00:00 app[web.1]: at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171-heroku]
2018-06-13T05:54:19.978267+00:00 app[web.1]: Caused by: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:19.978268+00:00 app[web.1]: at java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:19.978269+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:19.978270+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:19.978271+00:00 app[web.1]: at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:19.978272+00:00 app[web.1]: at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:19.978273+00:00 app[web.1]: at java.net.Socket.connect(Socket.java:589) ~[na:1.8.0_171-heroku]
2018-06-13T05:54:19.978274+00:00 app[web.1]: at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:19.978275+00:00 app[web.1]: at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:955) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:19.978276+00:00 app[web.1]: at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:907) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:19.978277+00:00 app[web.1]: at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:847) ~[amqp-client-5.1.2.jar!/:5.1.2]
2018-06-13T05:54:19.978278+00:00 app[web.1]: at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:449) ~[spring-rabbit-2.0.3.RELEASE.jar!/:2.0.3.RELEASE]
2018-06-13T05:54:19.978279+00:00 app[web.1]: ... 9 common frames omitted
2018-06-13T05:54:19.978280+00:00 app[web.1]:
2018-06-13T05:54:19.978370+00:00 app[web.1]: 2018-06-13 05:54:19.978 INFO 4 --- [ container-4] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2018-06-13T05:54:24.281046+00:00 app[worker.1]: 2018-06-13 05:54:24.280 WARN 4 --- [cTaskExecutor-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2018-06-13T05:54:24.281735+00:00 app[worker.1]: 2018-06-13 05:54:24.281 INFO 4 --- [cTaskExecutor-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#7170b3b5: tags=[{}], channel=null, acknowledgeMode=AUTO local queue size=0
2018-06-13T05:54:24.291703+00:00 app[worker.1]: 2018-06-13 05:54:24.291 INFO 4 --- [cTaskExecutor-3] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
Why is it trying to connect to localhost when I have specified host name explicitly in yml file? Any Idea?

Just found out that in yml file I have a profile named as heroku, when I removed it , it connected to the RabbitMQ in the given host.

If you are using spring boot you can configure Rabbit by spring cloud stream.
In this case you dont have to configure the beans and the configuration is much easier:
spring:
#---------------- RabbitMQ -----------------#
rabbitmq:
#Default username ans pass
dynamic: true
host: localhost
port: 5672
username: guest
password: guest
#---------------------------- RabbitMQ properties Commons ------------------------------#
cloud:
stream:
bindings:
springCloudBusInput:
destination: InputExchange
group: Queue
producer:
exchangeAutoDelete: false
springCloudBusOutput:
destination: InputExchange
group: Queue
consumer:
exchangeAutoDelete: false
Then you have to create the listener:
#Component
public class RemoteEventListener implements ApplicationListener<InputEvent> {
#Override
public void onApplicationEvent(InputEvent inputEvent) {
//whatever you want to do when a InputEvent Type is received in the queue
}
}
In this case My app is writing and receiving from the same exchange
and queue (Because of testing so stuff)
If you want to configure rabbit the way you shown, try to create a configuration class with the beans of the queue, exchange and biding with #Configuration. Dont declare the beans in your app class.
It seems it can not read the autodelete property of the queue, but if I'm not wrong I should take the default.
Maybe You have network issues
Check the rabbitmq and restart it
Can you acces to rabbitMq administrator interface?
About the comment about whi is trying to connect with localhost add this to your bean definition:
#Autowired
private ConnectionFactory rabbitConnectionFactory
#Bean
public RabbitTemplate rubeExchangeTemplate() {
RabbitTemplate r = new RabbitTemplate(rabbitConnectionFactory);
r.setExchange("rmq.rube.exchange");
r.setRoutingKey("rube.key");
r.setConnectionFactory(rabbitConnectionFactory);
return r;
}
also remove addresses of your application.yml

Related

Disabling or Increasing Timeout interval for RabbitMQ SpringBoot Amqp Connection Exception in local

I have a spring boot project that uses Spring AMPQ, no issues with hosting, I just want to disable the infinite retry connection locally or at least increase the time between retry attempts.
2022-08-16 13:56:42.849 INFO 40008 --- [ main] o.s.c.s.binder.DefaultBinderFactory : Creating binder: rabbit
2022-08-16 13:56:43.165 INFO 40008 --- [ main] o.s.c.s.binder.DefaultBinderFactory : Caching the binder: rabbit
2022-08-16 13:56:43.165 INFO 40008 --- [ main] o.s.c.s.binder.DefaultBinderFactory : Retrieving cached binder: rabbit
2022-08-16 13:56:43.271 INFO 40008 --- [ main] c.s.b.r.p.RabbitExchangeQueueProvisioner : declaring queue for inbound: springCloudBus.anonymous.4IzJRJtxT1afyh0KS7yI5w, bound to: springCloudBus
2022-08-16 13:56:43.274 INFO 40008 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:56:47.371 INFO 40008 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:56:51.460 INFO 40008 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:56:55.627 INFO 40008 --- [ main] o.s.c.stream.binder.BinderErrorChannel : Channel 'springCloudBus.anonymous.4IzJRJtxT1afyh0KS7yI5w.errors' has 1 subscriber(s).
2022-08-16 13:56:55.628 INFO 40008 --- [ main] o.s.c.stream.binder.BinderErrorChannel : Channel 'springCloudBus.anonymous.4IzJRJtxT1afyh0KS7yI5w.errors' has 2 subscriber(s).
2022-08-16 13:56:55.630 INFO 40008 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:56:59.673 INFO 40008 --- [ main] o.s.a.r.l.SimpleMessageListenerContainer : Broker not available; cannot force queue declarations during start: java.net.ConnectException: Connection refused: connect
2022-08-16 13:56:59.679 INFO 40008 --- [1afyh0KS7yI5w-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:57:03.931 INFO 40008 --- [ main] o.s.i.a.i.AmqpInboundChannelAdapter : started bean 'inbound.springCloudBus.anonymous.4IzJRJtxT1afyh0KS7yI5w'
2022-08-16 13:57:04.059 INFO 40008 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path ''
2022-08-16 13:57:05.110 INFO 40008 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Context refreshed
2022-08-16 13:57:05.140 INFO 40008 --- [ main] d.s.w.p.DocumentationPluginsBootstrapper : Found 1 custom documentation plugin(s)
2022-08-16 13:57:05.255 INFO 40008 --- [ main] s.d.s.w.s.ApiListingReferenceScanner : Scanning for api listing references
2022-08-16 13:57:05.362 INFO 40008 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: getApplicationFeedbackUsingGET_1
2022-08-16 13:57:05.404 INFO 40008 --- [ main] .d.s.w.r.o.CachingOperationNameGenerator : Generating unique operation named: getListUsingGET_1
2022-08-16 13:57:05.760 INFO 40008 --- [ main] o.s.i.monitor.IntegrationMBeanExporter : Registering MessageChannel springCloudBus.anonymous.4IzJRJtxT1afyh0KS7yI5w.errors
2022-08-16 13:57:06.992 INFO 40008 --- [22)-19.3.148.44] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:57:07.156 INFO 40008 --- [21)-19.3.148.44] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'
2022-08-16 13:57:07.156 INFO 40008 --- [21)-19.3.148.44] o.s.web.servlet.DispatcherServlet : Initializing Servlet 'dispatcherServlet'
2022-08-16 13:57:07.159 INFO 40008 --- [21)-19.3.148.44] o.s.web.servlet.DispatcherServlet : Completed initialization in 3 ms
2022-08-16 13:57:09.206 WARN 40008 --- [1afyh0KS7yI5w-1] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2022-08-16 13:57:09.209 INFO 40008 --- [1afyh0KS7yI5w-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#1727d525: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 13:57:11.086 INFO 40008 --- [1afyh0KS7yI5w-2] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:57:11.125 WARN 40008 --- [22)-19.3.148.44] o.s.b.a.amqp.RabbitHealthIndicator : Rabbit health check failed
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:61) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:602) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:724) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:252) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:2163) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2136) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2116) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.boot.actuate.amqp.RabbitHealthIndicator.getVersion(RabbitHealthIndicator.java:49) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.amqp.RabbitHealthIndicator.doHealthCheck(RabbitHealthIndicator.java:44) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:82) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthIndicator.getHealth(HealthIndicator.java:37) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.getHealth(HealthEndpoint.java:71) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.getHealth(HealthEndpoint.java:39) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:99) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getAggregateHealth(HealthEndpointSupport.java:110) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:96) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getHealth(HealthEndpointSupport.java:74) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getHealth(HealthEndpointSupport.java:61) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:65) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:55) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.3.10.jar:5.3.10]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:74) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:60) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:121) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:96) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809) ~[na:na]
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827) ~[na:na]
at java.base/jdk.internal.reflect.GeneratedMethodAccessor157.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) ~[na:na]
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) ~[na:na]
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method) ~[na:na]
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[na:na]
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) ~[na:na]
at java.base/java.net.Socket.connect(Socket.java:609) ~[na:na]
at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.12.0.jar:5.12.0]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1220) ~[amqp-client-5.12.0.jar:5.12.0]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1170) ~[amqp-client-5.12.0.jar:5.12.0]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connectAddresses(AbstractConnectionFactory.java:640) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connect(AbstractConnectionFactory.java:615) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:565) ~[spring-rabbit-2.3.10.jar:2.3.10]
... 49 common frames omitted
2022-08-16 13:57:15.193 INFO 40008 --- [22)-19.3.148.44] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:57:19.294 WARN 40008 --- [22)-19.3.148.44] o.s.b.a.amqp.RabbitHealthIndicator : Rabbit health check failed
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:61) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:602) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:724) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:252) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:2163) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2136) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2116) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.boot.actuate.amqp.RabbitHealthIndicator.getVersion(RabbitHealthIndicator.java:49) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.amqp.RabbitHealthIndicator.doHealthCheck(RabbitHealthIndicator.java:44) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.AbstractHealthIndicator.health(AbstractHealthIndicator.java:82) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthIndicator.getHealth(HealthIndicator.java:37) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.getHealth(HealthEndpoint.java:71) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.getHealth(HealthEndpoint.java:39) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:99) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getAggregateHealth(HealthEndpointSupport.java:110) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:96) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getAggregateHealth(HealthEndpointSupport.java:110) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getContribution(HealthEndpointSupport.java:96) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getHealth(HealthEndpointSupport.java:74) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpointSupport.getHealth(HealthEndpointSupport.java:61) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:65) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.health.HealthEndpoint.health(HealthEndpoint.java:55) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:282) ~[spring-core-5.3.10.jar:5.3.10]
at org.springframework.boot.actuate.endpoint.invoke.reflect.ReflectiveOperationInvoker.invoke(ReflectiveOperationInvoker.java:74) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.endpoint.annotation.AbstractDiscoveredOperation.invoke(AbstractDiscoveredOperation.java:60) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:121) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at org.springframework.boot.actuate.endpoint.jmx.EndpointMBean.invoke(EndpointMBean.java:96) ~[spring-boot-actuator-2.5.5.jar:2.5.5]
at java.management/com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:809) ~[na:na]
at java.management/com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1466) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1307) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1399) ~[na:na]
at java.management.rmi/javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:827) ~[na:na]
at java.base/jdk.internal.reflect.GeneratedMethodAccessor157.invoke(Unknown Source) ~[na:na]
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
at java.base/java.lang.reflect.Method.invoke(Method.java:566) ~[na:na]
at java.rmi/sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:359) ~[na:na]
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:200) ~[na:na]
at java.rmi/sun.rmi.transport.Transport$1.run(Transport.java:197) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.rmi/sun.rmi.transport.Transport.serviceCall(Transport.java:196) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:562) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:796) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.lambda$run$0(TCPTransport.java:677) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.rmi/sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:676) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[na:na]
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[na:na]
at java.base/java.lang.Thread.run(Thread.java:834) ~[na:na]
Caused by: java.net.ConnectException: Connection refused: connect
at java.base/java.net.PlainSocketImpl.waitForConnect(Native Method) ~[na:na]
at java.base/java.net.PlainSocketImpl.socketConnect(PlainSocketImpl.java:107) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224) ~[na:na]
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403) ~[na:na]
at java.base/java.net.Socket.connect(Socket.java:609) ~[na:na]
at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.12.0.jar:5.12.0]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1220) ~[amqp-client-5.12.0.jar:5.12.0]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1170) ~[amqp-client-5.12.0.jar:5.12.0]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connectAddresses(AbstractConnectionFactory.java:640) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connect(AbstractConnectionFactory.java:615) ~[spring-rabbit-2.3.10.jar:2.3.10]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:565) ~[spring-rabbit-2.3.10.jar:2.3.10]
... 51 common frames omitted
2022-08-16 13:57:20.269 WARN 40008 --- [1afyh0KS7yI5w-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2022-08-16 13:57:20.269 INFO 40008 --- [1afyh0KS7yI5w-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#92cb521: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 13:57:20.270 INFO 40008 --- [1afyh0KS7yI5w-3] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:57:29.439 WARN 40008 --- [1afyh0KS7yI5w-3] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2022-08-16 13:57:29.439 INFO 40008 --- [1afyh0KS7yI5w-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#3fa71956: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 13:57:29.440 INFO 40008 --- [1afyh0KS7yI5w-4] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 13:57:38.593 WARN 40008 --- [1afyh0KS7yI5w-4] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused: connect
2022-08-16 13:57:38.593 INFO 40008 --- [1afyh0KS7yI5w-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#54a50d69: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 13:57:38.593 INFO 40008 --- [1afyh0KS7yI5w-5] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
Trying to increase the back off interval doesn't seem to do anything.
#Configuration
#EnableRabbit
#Profile("!cloud")
public class LocalConfiguration
{
#Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(ConnectionFactory connectionFactory)
{
SimpleRabbitListenerContainerFactory simpleRabbitListenerContainerFactory = new SimpleRabbitListenerContainerFactory();
simpleRabbitListenerContainerFactory.setConnectionFactory(connectionFactory);
ExponentialBackOff exponentialBackOff = new ExponentialBackOff(100, 3.0);
simpleRabbitListenerContainerFactory.setRecoveryBackOff(exponentialBackOff);
return simpleRabbitListenerContainerFactory;
}
}
Is there a way to increase the timeout or disable the constant retries?
I just copied your factory and it works exactly as expected:
2022-08-16 14:03:06.012 WARN 97694 --- [ 127.0.0.1:5672] c.r.c.impl.ForgivingExceptionHandler : An unexpected connection driver error occurred (Exception message: Connection reset)
2022-08-16 14:03:06.499 INFO 97694 --- [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#30c31dd7: tags=[[amq.ctag-v4isXkIaMAAe_NHmUnHMzg]], channel=Cached Rabbit Channel: AMQChannel(amqp://guest#127.0.0.1:5672/,1), conn: Proxy#24be2d9c Shared Rabbit Connection: SimpleConnection#41200e0c [delegate=amqp://guest#127.0.0.1:5672/, localPort= 61142], acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:06.502 INFO 97694 --- [ntContainer#0-2] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:03:06.712 WARN 97694 --- [ntContainer#0-2] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:03:06.712 INFO 97694 --- [ntContainer#0-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#2a884e96: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:06.714 INFO 97694 --- [ntContainer#0-3] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:03:07.125 WARN 97694 --- [ntContainer#0-3] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:03:07.126 INFO 97694 --- [ntContainer#0-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#28a5e291: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:07.170 INFO 97694 --- [ntContainer#0-4] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:03:08.186 WARN 97694 --- [ntContainer#0-4] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:03:08.186 INFO 97694 --- [ntContainer#0-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#7e1e240: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:08.187 INFO 97694 --- [ntContainer#0-5] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:03:11.022 WARN 97694 --- [ntContainer#0-5] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:03:11.023 INFO 97694 --- [ntContainer#0-5] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#5285c94: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:11.025 INFO 97694 --- [ntContainer#0-6] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:03:19.328 WARN 97694 --- [ntContainer#0-6] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:03:19.329 INFO 97694 --- [ntContainer#0-6] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#7500ff90: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:19.330 INFO 97694 --- [ntContainer#0-7] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:03:43.661 WARN 97694 --- [ntContainer#0-7] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:03:43.662 INFO 97694 --- [ntContainer#0-7] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#70a5660e: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:03:43.664 INFO 97694 --- [ntContainer#0-8] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
2022-08-16 14:04:13.679 WARN 97694 --- [ntContainer#0-8] o.s.a.r.l.SimpleMessageListenerContainer : Consumer raised exception, processing can restart if the connection factory supports it. Exception summary: org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
2022-08-16 14:04:13.680 INFO 97694 --- [ntContainer#0-8] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#a7d0a48: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-08-16 14:04:13.682 INFO 97694 --- [ntContainer#0-9] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [localhost:5672]
The last retry is 30 seconds apart (which is the default max for an ExponentialBackOff (100ms, 300ms, 900ms, 2.7s, 8s, 24s, 30s).
Some retries have nothing to do with the listener container, it is the RabbitHealthIndicator that is trying to connect.
Your container retries appear to be a FixedBackOff of 9 seconds so something doesn't add up.

Running Spring app built with gradle and flyway on Heroku

I have a problem deploying my Spring boot application with gradle on heroku. The project works with flyway on migrations and postgres as database, I'm trying to do the deploy, but heroku is complaining and giving the following log:
2022-01-11T16:08:15.174724+00:00 app[web.1]: 2022-01-11 16:08:15.174 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.310829+00:00 app[web.1]: 2022-01-11 16:08:15.310 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.458987+00:00 app[web.1]: 2022-01-11 16:08:15.458 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.557556+00:00 app[web.1]: 2022-01-11 16:08:15.557 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.660010+00:00 app[web.1]: 2022-01-11 16:08:15.659 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.758015+00:00 app[web.1]: 2022-01-11 16:08:15.757 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.926062+00:00 app[web.1]: 2022-01-11 16:08:15.925 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:15.950385+00:00 app[web.1]: 2022-01-11 16:08:15.950 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "018 - criarArquivos"
2022-01-11T16:08:16.100506+00:00 app[web.1]: 2022-01-11 16:08:16.100 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.143832+00:00 app[web.1]: 2022-01-11 16:08:16.143 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.162863+00:00 app[web.1]: 2022-01-11 16:08:16.162 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "019 - criarArquivosProposta"
2022-01-11T16:08:16.294016+00:00 app[web.1]: 2022-01-11 16:08:16.293 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.336561+00:00 app[web.1]: 2022-01-11 16:08:16.336 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.362030+00:00 app[web.1]: 2022-01-11 16:08:16.361 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "020 - criarArquivosEdital"
2022-01-11T16:08:16.469778+00:00 app[web.1]: 2022-01-11 16:08:16.469 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.531438+00:00 app[web.1]: 2022-01-11 16:08:16.531 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.551781+00:00 app[web.1]: 2022-01-11 16:08:16.551 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Migrating schema "public" to version "021 - criarArquivosUsuario"
2022-01-11T16:08:16.646818+00:00 app[web.1]: 2022-01-11 16:08:16.646 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.717529+00:00 app[web.1]: 2022-01-11 16:08:16.717 INFO 4 --- [ main] o.f.c.i.s.DefaultSqlScriptExecutor : 0 rows affected
2022-01-11T16:08:16.737369+00:00 app[web.1]: 2022-01-11 16:08:16.737 INFO 4 --- [ main] o.f.core.internal.command.DbMigrate : Successfully applied 21 migrations to schema "public", now at version v021 (execution time 00:11.952s)
2022-01-11T16:08:16.974590+00:00 app[web.1]: 2022-01-11 16:08:16.974 INFO 4 --- [ main] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2022-01-11T16:08:17.048129+00:00 app[web.1]: 2022-01-11 16:08:17.047 INFO 4 --- [ main] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.32.Final
2022-01-11T16:08:17.275410+00:00 app[web.1]: 2022-01-11 16:08:17.275 INFO 4 --- [ main] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
2022-01-11T16:08:17.435786+00:00 app[web.1]: 2022-01-11 16:08:17.435 INFO 4 --- [ main] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQLDialect
2022-01-11T16:08:20.352207+00:00 app[web.1]: 2022-01-11 16:08:20.351 INFO 4 --- [ main] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2022-01-11T16:08:20.365827+00:00 app[web.1]: 2022-01-11 16:08:20.365 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2022-01-11T16:08:20.556259+00:00 app[web.1]: 2022-01-11 16:08:20.556 WARN 4 --- [ main] JpaBaseConfiguration$JpaWebConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning
2022-01-11T16:08:24.205506+00:00 app[web.1]: 2022-01-11 16:08:24.205 WARN 4 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arquivosController': Unsatisfied dependency expressed through field 'arquivosPropostasService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arquivosPropostasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.220521+00:00 app[web.1]: 2022-01-11 16:08:24.220 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-01-11T16:08:24.222658+00:00 app[web.1]: 2022-01-11 16:08:24.222 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-01-11T16:08:24.255639+00:00 app[web.1]: 2022-01-11 16:08:24.255 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2022-01-11T16:08:24.258455+00:00 app[web.1]: 2022-01-11 16:08:24.258 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2022-01-11T16:08:24.285249+00:00 app[web.1]: 2022-01-11 16:08:24.285 INFO 4 --- [ main] ConditionEvaluationReportLoggingListener :
2022-01-11T16:08:24.285251+00:00 app[web.1]:
2022-01-11T16:08:24.285253+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2022-01-11T16:08:24.319226+00:00 app[web.1]: 2022-01-11 16:08:24.318 ERROR 4 --- [ main] o.s.boot.SpringApplication : Application run failed
2022-01-11T16:08:24.319228+00:00 app[web.1]:
2022-01-11T16:08:24.319231+00:00 app[web.1]: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'arquivosController': Unsatisfied dependency expressed through field 'arquivosPropostasService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arquivosPropostasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.319239+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:660) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319239+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319240+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319241+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319242+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319242+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319243+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319246+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319246+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319246+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319247+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319247+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:944) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319247+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:918) ~[spring-context-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319248+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:583) ~[spring-context-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319248+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:145) ~[spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319248+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319249+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:434) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319249+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:338) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319250+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1343) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319250+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1332) [spring-boot-2.5.2.jar!/:2.5.2]
2022-01-11T16:08:24.319250+00:00 app[web.1]: at com.sti.sigproj.SigprojApplication.main(SigprojApplication.java:10) [classes!/:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319253+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319253+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319258+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_312-heroku]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:108) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319259+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [sigproj-0.0.1-SNAPSHOT.jar:0.0.1-SNAPSHOT]
2022-01-11T16:08:24.319261+00:00 app[web.1]: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arquivosPropostasService': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.319261+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:405) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319261+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1413) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319262+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:601) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319262+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319262+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319263+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319263+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319263+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:208) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319264+00:00 app[web.1]: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319264+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1380) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319264+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319265+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319266+00:00 app[web.1]: ... 28 common frames omitted
2022-01-11T16:08:24.319266+00:00 app[web.1]: Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'arquivos.propostas' in value "${arquivos.propostas}"
2022-01-11T16:08:24.319266+00:00 app[web.1]: at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:180) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:239) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210) ~[spring-core-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319267+00:00 app[web.1]: at org.springframework.context.support.PropertySourcesPlaceholderConfigurer.lambda$processProperties$0(PropertySourcesPlaceholderConfigurer.java:175) ~[spring-context-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319268+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:936) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319270+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1321) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1300) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.resolveFieldValue(AutowiredAnnotationBeanPostProcessor.java:657) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319271+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:119) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319272+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.3.8.jar!/:5.3.8]
2022-01-11T16:08:24.319272+00:00 app[web.1]: ... 39 common frames omitted
2022-01-11T16:08:24.319272+00:00 app[web.1]:
2022-01-11T16:08:24.514445+00:00 heroku[web.1]: Process exited with status 1
2022-01-11T16:08:24.655431+00:00 heroku[web.1]: State changed from starting to crashed
2022-01-11T16:08:25.702604+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=api-sistemaderegistroatual.herokuapp.com request_id=7d4601b8-32fa-4a8a-b375-c03c3d194bf6 fwd="179.124.141.140" dyno= connect= service= status=503 bytes= protocol=https
2022-01-11T16:08:26.525942+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=api-sistemaderegistroatual.herokuapp.com request_id=95fbafa2-4c6a-40c5-b6cb-4d0a1217eb39 fwd="179.124.141.140" dyno= connect= service= status=503 bytes= protocol=https
This is my current build.gradle:
plugins {
id 'java'
id 'maven-publish'
id "org.springframework.boot" version "2.5.2"
id "io.spring.dependency-management" version "1.0.11.RELEASE"
}
jar {
manifest {
attributes(
'Main-Class': 'com.sti.sigproj.SigprojApplication'
)
}
}
repositories {
mavenLocal()
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-jpa:2.5.2'
implementation 'org.springframework.boot:spring-boot-starter-validation:2.5.2'
implementation 'org.springframework.boot:spring-boot-starter-web:2.5.2'
implementation 'org.flywaydb:flyway-core:7.7.3'
implementation 'org.springframework.boot:spring-boot-starter-security:2.5.2'
implementation 'org.springframework.boot:spring-boot-starter-oauth2-client:2.5.2'
implementation 'org.modelmapper.extensions:modelmapper-spring:2.3.0'
implementation 'commons-codec:commons-codec:1.15'
implementation 'io.jsonwebtoken:jjwt:0.7.0'
implementation 'org.springframework.boot:spring-boot-starter-mail:2.5.2'
implementation 'io.springfox:springfox-swagger2:2.9.2'
implementation 'io.springfox:springfox-swagger-ui:2.9.2'
implementation('com.github.javafaker:javafaker:1.0.2') { exclude module: 'snakeyaml' }
runtimeOnly 'com.h2database:h2:1.4.200'
runtimeOnly 'org.springframework.boot:spring-boot-devtools:2.5.2'
runtimeOnly 'org.postgresql:postgresql:42.2.22'
testImplementation 'org.flywaydb.flyway-test-extensions:flyway-spring-test:5.0.0'
testImplementation 'org.springframework.boot:spring-boot-starter-test:2.5.2'
testImplementation 'org.springframework.security:spring-security-test:5.5.1'
testImplementation 'org.junit.vintage:junit-vintage-engine:5.7.2'
}
group = 'com.sti.sigproj'
version = '0.0.1-SNAPSHOT'
description = 'sigproj'
java.sourceCompatibility = JavaVersion.VERSION_1_8
publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
test {
useJUnitPlatform()
}
And here is the procfile:
web: java -Dserver.port=$PORT $JAVA_OPTS -jar target/sigproj-0.0.1-SNAPSHOT.jar
flyway:migrate
Here is the part heroku is complaining in the arquivosPropostaService.java:
#Value("${arquivos.propostas.doc-chefia-imediata}")
private String diretorioDocsChefiaImediata;
That leads to application.properties:
arquivos.propostas=/arquivos/propostas
arquivos.propostas.doc-chefia-imediata=/docs-chefia-imediata
The project contains maven and recently was changed to gradle. I think the problem is in the procfile and in build.gradle or maybe some lack in config vars, an old version of the project worked on maven, but the current version needs gradle.

Problem with date loading in Spring App deployed to Heroku

I have a simple spring boot application using postgres as a database. When I run the application locally everything is fine, but when I deploy it to heroku I get a NullPointerException when accessing the date property of the User object. When the bean is initialized, a User is created, the payment field initiated with new date, then the user is saved to the database, if after that the user is retrieved from the database, the date is null. When I run the application on local postgres everything is fine, the date is saved and after reloading the user it is present. What might be causing this error?
Here's User class
#Entity
#Table(name = "users")
public class User {
#Id
#GeneratedValue(strategy = GenerationType.AUTO)
#Column(name = "id")
private int id;
#Column(name = "name")
private String name;
#Column(name = "login")
private String login;
#Column(name = "password")
private String password;
#Column(name = "current_fund")
private int currentFund;
#Column(name = "payment")
private Date payment;
And here's how User is created in userService:
#Service
public class UserService {
#Autowired
private UserRepo userRepo;
public UserService() {
}
public void save(User user) {
userRepo.save(user);
}
public User getUser() {
System.err.println("===============================");
System.err.println("=IN USER SERVICE NOW=");
System.err.println("===============================");
User user = new User();
user.setCurrentFund(0);
user.setLogin("1");
user.setPassword("2");
user.setName("45");
user.setPayment(new Date());
System.err.println("===============================");
System.err.println("=USER CREATED=" + user.toString());
System.err.println("===============================");
userRepo.save(user);
System.err.println("===============================");
System.err.println("=USER SAVED=");
System.err.println("===============================");
User us = userRepo.findAll().iterator().next();
System.err.println("===============================");
System.err.println("=USER LOADED=" + us);
System.err.println("===============================");
return us;
}
}
Here's Heroku logs tail:
2021-10-15T09:26:51.323443+00:00 app[web.1]: 2021-10-15 09:26:51.323 INFO 4 --- [ task-1] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [name: default]
2021-10-15T09:26:51.326054+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326080+00:00 app[web.1]: =IN EVENT SERVICE INIT=
2021-10-15T09:26:51.326107+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326144+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326170+00:00 app[web.1]: =IN USER SERVICE NOW=
2021-10-15T09:26:51.326195+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326426+00:00 app[web.1]: ===============================
2021-10-15T09:26:51.326701+00:00 app[web.1]: =USER CREATED=User{id=0, name='45', login='1', password='2', currentFund=0, lastPaymentDate=Wed Sep 15 09:26:51 UTC 2021}
2021-10-15T09:26:51.326730+00:00 app[web.1]: ===============================
2021-10-15T09:26:52.018035+00:00 app[web.1]: 2021-10-15 09:26:52.017 INFO 4 --- [ task-1] org.hibernate.Version : HHH000412: Hibernate ORM core version 5.4.21.Final
2021-10-15T09:26:52.170196+00:00 app[web.1]: 2021-10-15 09:26:52.170 INFO 4 --- [ task-1] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.1.0.Final}
2021-10-15T09:26:52.994040+00:00 app[web.1]: 2021-10-15 09:26:52.993 INFO 4 --- [ task-1] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.PostgreSQL10Dialect
2021-10-15T09:26:54.444953+00:00 app[web.1]: 2021-10-15 09:26:54.444 INFO 4 --- [ task-1] o.h.e.t.j.p.i.JtaPlatformInitiator : HHH000490: Using JtaPlatform implementation: [org.hibernate.engine.transaction.jta.platform.internal.NoJtaPlatform]
2021-10-15T09:26:54.455185+00:00 app[web.1]: 2021-10-15 09:26:54.454 INFO 4 --- [ task-1] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default'
2021-10-15T09:26:55.163731+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.163755+00:00 app[web.1]: =USER SAVED=
2021-10-15T09:26:55.163777+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.355926+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.355965+00:00 app[web.1]: =USER LOADED=User{id=1, name='45', login='1', password='2', currentFund=0, lastPaymentDate=null}
2021-10-15T09:26:55.355999+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.356028+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.356079+00:00 app[web.1]: =USER=User{id=1, name='45', login='1', password='2', currentFund=0, lastPaymentDate=null}
2021-10-15T09:26:55.356107+00:00 app[web.1]: ===============================
2021-10-15T09:26:55.402277+00:00 app[web.1]: start events update
2021-10-15T09:26:55.408357+00:00 app[web.1]: 2021-10-15 09:26:55.408 WARN 4 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'purchaseController': Unsatisfied dependency expressed through field 'eventsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsService': Invocation of init method failed; nested exception is java.lang.NullPointerException
2021-10-15T09:26:55.408900+00:00 app[web.1]: 2021-10-15 09:26:55.408 INFO 4 --- [ main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2021-10-15T09:26:55.410937+00:00 app[web.1]: 2021-10-15 09:26:55.410 INFO 4 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-10-15T09:26:55.411578+00:00 app[web.1]: 2021-10-15 09:26:55.411 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2021-10-15T09:26:55.967177+00:00 app[web.1]: 2021-10-15 09:26:55.966 INFO 4 --- [ main] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2021-10-15T09:26:55.969102+00:00 app[web.1]: 2021-10-15 09:26:55.968 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-10-15T09:26:55.978337+00:00 app[web.1]: 2021-10-15 09:26:55.978 INFO 4 --- [ main] ConditionEvaluationReportLoggingListener :
2021-10-15T09:26:55.978338+00:00 app[web.1]:
2021-10-15T09:26:55.978339+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-10-15T09:26:55.982750+00:00 app[web.1]: 2021-10-15 09:26:55.982 ERROR 4 --- [ main] o.s.boot.SpringApplication : Application run failed
2021-10-15T09:26:55.982754+00:00 app[web.1]:
2021-10-15T09:26:55.982761+00:00 app[web.1]: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'purchaseController': Unsatisfied dependency expressed through field 'eventsService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsService': Invocation of init method failed; nested exception is java.lang.NullPointerException
2021-10-15T09:26:55.982762+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982762+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:130) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982764+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982765+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1420) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982765+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982765+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982766+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982766+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982767+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982767+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982767+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982768+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982768+00:00 app[web.1]: at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551) ~[spring-context-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982768+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143) ~[spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982769+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982769+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982770+00:00 app[web.1]: at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982770+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982770+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982771+00:00 app[web.1]: at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.3.4.RELEASE.jar!/:2.3.4.RELEASE]
2021-10-15T09:26:55.982771+00:00 app[web.1]: at main.Main.main(Main.java:9) [classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982772+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982772+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982776+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982777+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982777+00:00 app[web.1]: at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982777+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:107) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982778+00:00 app[web.1]: at org.springframework.boot.loader.Launcher.launch(Launcher.java:58) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982778+00:00 app[web.1]: at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88) [purchase-planner-web2-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
2021-10-15T09:26:55.982779+00:00 app[web.1]: Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'eventsService': Invocation of init method failed; nested exception is java.lang.NullPointerException
2021-10-15T09:26:55.982779+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:160) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982779+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:415) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982780+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982780+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982780+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982781+00:00 app[web.1]: at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982782+00:00 app[web.1]: at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982782+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1307) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982782+00:00 app[web.1]: at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1227) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982783+00:00 app[web.1]: at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:640) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982783+00:00 app[web.1]: ... 28 common frames omitted
2021-10-15T09:26:55.982784+00:00 app[web.1]: Caused by: java.lang.NullPointerException: null
2021-10-15T09:26:55.982784+00:00 app[web.1]: at java.util.Calendar.setTime(Calendar.java:1770) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982785+00:00 app[web.1]: at main.handlers.EventsService.getDate0AM(EventsService.java:246) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982785+00:00 app[web.1]: at main.handlers.EventsService.fillWithEmptyPayments(EventsService.java:72) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982785+00:00 app[web.1]: at main.handlers.EventsService.updateEvents(EventsService.java:49) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982786+00:00 app[web.1]: at main.handlers.EventsService.init(EventsService.java:42) ~[classes!/:1.0-SNAPSHOT]
2021-10-15T09:26:55.982786+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982787+00:00 app[web.1]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982789+00:00 app[web.1]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982790+00:00 app[web.1]: at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_302-heroku]
2021-10-15T09:26:55.982791+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleElement.invoke(InitDestroyAnnotationBeanPostProcessor.java:389) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982791+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor$LifecycleMetadata.invokeInitMethods(InitDestroyAnnotationBeanPostProcessor.java:333) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982791+00:00 app[web.1]: at org.springframework.beans.factory.annotation.InitDestroyAnnotationBeanPostProcessor.postProcessBeforeInitialization(InitDestroyAnnotationBeanPostProcessor.java:157) ~[spring-beans-5.2.9.RELEASE.jar!/:5.2.9.RELEASE]
2021-10-15T09:26:55.982792+00:00 app[web.1]: ... 40 common frames omitted
2021-10-15T09:26:55.982792+00:00 app[web.1]:
2021-10-15T09:26:56.147680+00:00 heroku[web.1]: Process exited with status 1
When comment out all references to "payment" field, app starts just fine.
Also, there are other objects in my app, using Date as one of their fields, and these objects are loaded properly

Failed to start bean 'webServerStartStop'; Unable to start embedded Tomcat server - spring-boot-starter-web

Spring application using Maven including only Spring Web dependency gives "Unable to start embedded Tomcat serve" error.
The same project runs on other computers like expected.
Spring Boot Version: 2.4.3
Package Type: JAR
Java Version: 11
No additional code added from the starter project except to print to the console for testing.
Application runs and prints to the console like expected when tomcat is excluded int the pom.xml.
Tested multiple ports.
Tested JDK 8 and 11.
pom.xml dependancies:
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
Log:
2021-02-22 16:17:28.896 INFO 34556 --- [ main] com.example.demo.DemoApplication : Starting DemoApplication using Java 11.0.10 on Soul with PID 34556 (C:\Users\ryne0\Desktop\FullStackWeb\Spring\demo\target\classes started by ryne0 in C:\Users\ryne0\Desktop\FullStackWeb\Spring\demo)
2021-02-22 16:17:28.900 INFO 34556 --- [ main] com.example.demo.DemoApplication : No active profile set, falling back to default profiles: default
2021-02-22 16:17:28.902 DEBUG 34556 --- [ main] o.s.boot.SpringApplication : Loading source class com.example.demo.DemoApplication
2021-02-22 16:17:28.995 DEBUG 34556 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext#457c9034
2021-02-22 16:17:30.317 DEBUG 34556 --- [ main] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\ryne0\.m2\repository\org\springframework\boot\spring-boot\2.4.3\spring-boot-2.4.3.jar
2021-02-22 16:17:30.318 DEBUG 34556 --- [ main] .s.b.w.e.t.TomcatServletWebServerFactory : Code archive: C:\Users\ryne0\.m2\repository\org\springframework\boot\spring-boot\2.4.3\spring-boot-2.4.3.jar
2021-02-22 16:17:30.318 DEBUG 34556 --- [ main] .s.b.w.e.t.TomcatServletWebServerFactory : None of the document roots [src/main/webapp, public, static] point to a directory and will be ignored.
2021-02-22 16:17:30.353 INFO 34556 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 81 (http)
2021-02-22 16:17:30.374 INFO 34556 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-02-22 16:17:30.387 INFO 34556 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.43]
2021-02-22 16:17:30.507 INFO 34556 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-02-22 16:17:30.507 DEBUG 34556 --- [ main] w.s.c.ServletWebServerApplicationContext : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2021-02-22 16:17:30.508 INFO 34556 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1513 ms
2021-02-22 16:17:30.535 DEBUG 34556 --- [ main] o.s.b.w.s.ServletContextInitializerBeans : Mapping filters: characterEncodingFilter urls=[/*] order=-2147483648, formContentFilter urls=[/*] order=-9900, requestContextFilter urls=[/*] order=-105
2021-02-22 16:17:30.547 DEBUG 34556 --- [ main] o.s.b.w.s.ServletContextInitializerBeans : Mapping servlets: dispatcherServlet urls=[/]
2021-02-22 16:17:30.599 DEBUG 34556 --- [ main] o.s.b.w.s.f.OrderedRequestContextFilter : Filter 'requestContextFilter' configured for use
2021-02-22 16:17:30.600 DEBUG 34556 --- [ main] s.b.w.s.f.OrderedCharacterEncodingFilter : Filter 'characterEncodingFilter' configured for use
2021-02-22 16:17:30.600 DEBUG 34556 --- [ main] o.s.b.w.s.f.OrderedFormContentFilter : Filter 'formContentFilter' configured for use
2021-02-22 16:17:30.817 INFO 34556 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-02-22 16:17:30.828 DEBUG 34556 --- [ main] s.w.s.m.m.a.RequestMappingHandlerAdapter : ControllerAdvice beans: 0 #ModelAttribute, 0 #InitBinder, 1 RequestBodyAdvice, 1 ResponseBodyAdvice
2021-02-22 16:17:30.949 DEBUG 34556 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : 2 mappings in 'requestMappingHandlerMapping'
2021-02-22 16:17:30.991 DEBUG 34556 --- [ main] o.s.w.s.handler.SimpleUrlHandlerMapping : Patterns [/webjars/**, /**] in 'resourceHandlerMapping'
2021-02-22 16:17:31.003 DEBUG 34556 --- [ main] .m.m.a.ExceptionHandlerExceptionResolver : ControllerAdvice beans: 0 #ExceptionHandler, 1 ResponseBodyAdvice
2021-02-22 16:17:31.104 WARN 34556 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
2021-02-22 16:17:31.110 INFO 34556 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Shutting down ExecutorService 'applicationTaskExecutor'
2021-02-22 16:17:31.122 INFO 34556 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-02-22 16:17:31.197 DEBUG 34556 --- [ main] ConditionEvaluationReportLoggingListener :
2021-02-22 16:17:32.117 ERROR 34556 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:181) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.DefaultLifecycleProcessor.access$200(DefaultLifecycleProcessor.java:54) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:356) ~[spring-context-5.3.4.jar:5.3.4]
at java.base/java.lang.Iterable.forEach(Iterable.java:75) ~[na:na]
at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:155) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:123) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:934) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:585) ~[spring-context-5.3.4.jar:5.3.4]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:144) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:767) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:759) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:426) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:326) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1311) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1300) ~[spring-boot-2.4.3.jar:2.4.3]
at com.example.demo.DemoApplication.main(DemoApplication.java:10) ~[classes/:na]
Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:229) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:43) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:178) ~[spring-context-5.3.4.jar:5.3.4]
... 15 common frames omitted
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:244) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:282) ~[spring-boot-2.4.3.jar:2.4.3]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:213) ~[spring-boot-2.4.3.jar:2.4.3]
... 17 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1074) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:240) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
... 19 common frames omitted
Caused by: java.io.IOException: Unable to establish loopback connection
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:94) ~[na:na]
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:61) ~[na:na]
at java.base/java.security.AccessController.doPrivileged(Native Method) ~[na:na]
at java.base/sun.nio.ch.PipeImpl.<init>(PipeImpl.java:171) ~[na:na]
at java.base/sun.nio.ch.SelectorProviderImpl.openPipe(SelectorProviderImpl.java:50) ~[na:na]
at java.base/java.nio.channels.Pipe.open(Pipe.java:155) ~[na:na]
at java.base/sun.nio.ch.WindowsSelectorImpl.<init>(WindowsSelectorImpl.java:142) ~[na:na]
at java.base/sun.nio.ch.WindowsSelectorProvider.openSelector(WindowsSelectorProvider.java:44) ~[na:na]
at java.base/java.nio.channels.Selector.open(Selector.java:295) ~[na:na]
at org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector(NioSelectorPool.java:52) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.NioSelectorPool.close(NioSelectorPool.java:119) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.NioEndpoint.unbind(NioEndpoint.java:386) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1198) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1279) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:608) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1071) ~[tomcat-embed-core-9.0.43.jar:9.0.43]
... 21 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address: connect
at java.base/sun.nio.ch.Net.connect0(Native Method) ~[na:na]
at java.base/sun.nio.ch.Net.connect(Net.java:476) ~[na:na]
at java.base/sun.nio.ch.Net.connect(Net.java:468) ~[na:na]
at java.base/sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:694) ~[na:na]
at java.base/java.nio.channels.SocketChannel.open(SocketChannel.java:194) ~[na:na]
at java.base/sun.nio.ch.PipeImpl$Initializer$LoopbackConnector.run(PipeImpl.java:127) ~[na:na]
at java.base/sun.nio.ch.PipeImpl$Initializer.run(PipeImpl.java:76) ~[na:na]
... 36 common frames omitted
There was control software installed for the individuals Network interface controller (NIC) that allowed both ethernet and wifi to be used simultaneously. This was installed to supposedly improve gaming experience, but did not play nicely with tomcat in Spring. Once disabled the application was able to run as expected.
Edit:
A similar error occurs if your address or port is incorrect / already used. This fixes the error in most situations, but a driver like the one mentioned above may cause the error.
It got fixed for me after changing server.port to 8080 from 80.
I was trying to run spring boot on my local network and that error occurred.
The problem was a wrongly specified IP address property inside my application-dev.yml file.
server:
address: 192.168.0.107 // it needed to be 192.168.0.104
port: 8080
You can always check your IPv4 Address by running ipconfig.
Disable the Gamingservices service or go to the task manager and end the task of gamingservices and run again the application. or restart the computer.

Connection refused: connect in jhipster

I am new to Jhipster. I have tried to run mvnw but request execution error of Connection refused: connect is occurred.
2017-07-14 10:36:17.411 INFO 19864 --- [ restartedMain] com.netflix.discovery.DiscoveryClient : Saw local status change event StatusChangeEvent [timestamp=1500008777411, current=UP, previous=STARTING]
2017-07-14 10:36:17.946 INFO 19864 --- [ restartedMain] com.lxisoft.diviso.DivisoApp : Started DivisoApp in 27.953 seconds (JVM running for 29.457)
2017-07-14 10:36:17.961 INFO 19864 --- [ restartedMain] com.lxisoft.diviso.DivisoApp :
----------------------------------------------------------
Application 'diviso' is running! Access URLs:
Local: http://localhost:8080
External: http://192.168.43.43:8080
Profile(s): [swagger, dev]
----------------------------------------------------------
2017-07-14 10:36:17.978 INFO 19864 --- [ restartedMain] com.lxisoft.diviso.DivisoApp :
----------------------------------------------------------
Config Server: Not found or not setup for this application
----------------------------------------------------------
2017-07-14 10:36:18.463 WARN 19864 --- [nfoReplicator-0] c.c.c.ConfigServicePropertySourceLocator : Could not locate PropertySource: I/O error on GET request for "http://localhost:8761/config/diviso/dev/master": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
2017-07-14 10:36:18.467 INFO 19864 --- [nfoReplicator-0] com.netflix.discovery.DiscoveryClient : DiscoveryClient_DIVISO/diviso:44489811627d5f65d0e44a2af1489c68: registering service...
2017-07-14 10:36:20.480 ERROR 19864 --- [nfoReplicator-0] c.n.d.s.t.d.RedirectingEurekaHttpClient : Request execution error
com.sun.jersey.api.client.ClientHandlerException: java.net.ConnectException: Connection refused: connect
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:187)
at com.sun.jersey.api.client.filter.GZIPContentEncodingFilter.handle(GZIPContentEncodingFilter.java:123)
at com.netflix.discovery.EurekaIdentityHeaderFilter.handle(EurekaIdentityHeaderFilter.java:27)
at com.sun.jersey.api.client.Client.handle(Client.java:652)
at com.sun.jersey.api.client.WebResource.handle(WebResource.java:682)
at com.sun.jersey.api.client.WebResource.access$200(WebResource.java:74)
at com.sun.jersey.api.client.WebResource$Builder.post(WebResource.java:570)
at com.netflix.discovery.shared.transport.jersey.AbstractJerseyEurekaHttpClient.register(AbstractJerseyEurekaHttpClient.java:56)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59)
at com.netflix.discovery.shared.transport.decorator.MetricsCollectingEurekaHttpClient.execute(MetricsCollectingEurekaHttpClient.java:73)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59)
at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.executeOnNewServer(RedirectingEurekaHttpClient.java:118)
at com.netflix.discovery.shared.transport.decorator.RedirectingEurekaHttpClient.execute(RedirectingEurekaHttpClient.java:79)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59)
at com.netflix.discovery.shared.transport.decorator.RetryableEurekaHttpClient.execute(RetryableEurekaHttpClient.java:119)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator$1.execute(EurekaHttpClientDecorator.java:59)
at com.netflix.discovery.shared.transport.decorator.SessionedEurekaHttpClient.execute(SessionedEurekaHttpClient.java:77)
at com.netflix.discovery.shared.transport.decorator.EurekaHttpClientDecorator.register(EurekaHttpClientDecorator.java:56)
at com.netflix.discovery.DiscoveryClient.register(DiscoveryClient.java:798)
at com.netflix.discovery.InstanceInfoReplicator.run(InstanceInfoReplicator.java:104)
at com.netflix.discovery.InstanceInfoReplicator$1.run(InstanceInfoReplicator.java:88)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.net.ConnectException: Connection refused: connect
at java.net.DualStackPlainSocketImpl.waitForConnect(Native Method)
at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:85)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)
at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:144)
at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:134)
at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)
at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)
at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:118)
at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:56)
at com.sun.jersey.client.apache4.ApacheHttpClient4Handler.handle(ApacheHttpClient4Handler.java:173)
... 30 common frames omitted
Could not locate PropertySource: I/O error on GET request for "http://localhost:8761/config/diviso/dev/master": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused
This warning message means that your application could not connect to its spring cloud config server: JHipster Registry.
In dev profile, this is just a warning that you can ignore as your application can run with local application properties in sc/main/resources/config.
In prod profile, this would be an error and your application would not start. The registry must be started before your app because this is where your app gets its application properties from and registers itself as an Eureka client.
So in dev, you can ignore this warning or if it annoys you, you can start a registry.
If your app is a monolith application and not a microservice application, you can opt out the discovery client question, it'll be simpler to deploy if you don't need horizontal scaling.
The same issue happened with me, although I have already generated and modified my project before.
In case you are using MySql, go to phpMyAdmin page and type in your credentials. Worked for me.

Categories