for our integration-test profile we want to disable Spring's automatic reconnecting to fail fast.
Attempting to connect to: [rabbitmq-invalid-host:5672]
Error creating consumer; retrying in 5000
org.springframework.amqp.AmqpConnectException: org.springframework.amqp.AmqpIOException: java.net.UnknownHostException: rabbitmq-invalid-host
the following settings do not have any effect yet:
spring.rabbitmq.connection-timeout=1000
spring.rabbitmq.requested-heartbeat=1
spring.rabbitmq.listener.direct.missing-queues-fatal=true
spring.rabbitmq.listener.direct.retry.enabled=false
spring.rabbitmq.template.retry.enabled=false
any idea how to make amqp give up or even destroy the whole app-context?
full stacktrace:
2019-06-11 14:56:31.596 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:31.698 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:31.902 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:32.305 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:33.108 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:34.709 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:36.476 INFO 3025 --- [ntContainer#0-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
2019-06-11 14:56:36.477 ERROR 3025 --- [ntContainer#0-1] o.s.a.r.l.DirectMessageListenerContainer : Error creating consumer; retrying in 5000
org.springframework.amqp.AmqpConnectException: org.springframework.amqp.AmqpIOException: java.net.UnknownHostException: rabbitmq-invalid-host
at org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer.doConsumeFromQueue(DirectMessageListenerContainer.java:667) [spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer.consumeFromQueue(DirectMessageListenerContainer.java:645) [spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer.startConsumers(DirectMessageListenerContainer.java:550) [spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer.lambda$actualStart$1(DirectMessageListenerContainer.java:410) [spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at java.lang.Thread.run(Thread.java:748) ~[na:1.8.0_212]
Caused by: org.springframework.amqp.AmqpIOException: java.net.UnknownHostException: rabbitmq-invalid-host
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:71) ~[spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:509) ~[spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:700) ~[spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
at org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer.doConsumeFromQueue(DirectMessageListenerContainer.java:663) [spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
... 4 common frames omitted
Caused by: java.net.UnknownHostException: rabbitmq-invalid-host
at java.net.InetAddress.getAllByName0(InetAddress.java:1281) ~[na:1.8.0_212]
at java.net.InetAddress.getAllByName(InetAddress.java:1193) ~[na:1.8.0_212]
at java.net.InetAddress.getAllByName(InetAddress.java:1127) ~[na:1.8.0_212]
at com.rabbitmq.client.DnsRecordIpAddressResolver.resolveIpAddresses(DnsRecordIpAddressResolver.java:83) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.DnsRecordIpAddressResolver.getAddresses(DnsRecordIpAddressResolver.java:73) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1098) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1054) ~[amqp-client-5.4.3.jar:5.4.3]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:994) ~[amqp-client-5.4.3.jar:5.4.3]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:462) ~[spring-rabbit-2.1.6.RELEASE.jar:2.1.6.RELEASE]
... 6 common frames omitted
2019-06-11 14:56:37.912 INFO 3025 --- [ main] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq-invalid-host:5672]
You can listen for the exception in an event listener...
#SpringBootApplication
public class So56270299Application {
public static void main(String[] args) {
SpringApplication.run(So56270299Application.class, args);
}
#EventListener
public void events(ListenerContainerConsumerFailedEvent event) {
System.out.println(event);
if (event.getThrowable().getCause() instanceof UnknownHostException) {
System.exit(1);
}
}
#RabbitListener(queues = "so56270299")
public void listen(String in) {
}
}
and
spring.rabbitmq.host=junk
and
2019-06-11 09:15:09.205 INFO 96620 --- [ntContainer#0-1] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [junk:5672]
2019-06-11 09:15:09.212 INFO 96620 --- [ main] com.example.So56270299Application : Started So56270299Application in 0.704 seconds (JVM running for 1.071)
ListenerContainerConsumerFailedEvent [reason=Consumer raised exception, attempting restart, fatal=false, throwable=org.springframework.amqp.AmqpIOException: java.net.UnknownHostException: junk, container=SimpleMessageListenerContainer [concurrentConsumers=1, queueNames=[so56270299]]]
2019-06-11 09:15:14.255 INFO 96620 --- [ Thread-2] o.s.a.r.l.SimpleMessageListenerContainer : Waiting for workers to finish.
2019-06-11 09:15:14.255 INFO 96620 --- [ Thread-2] o.s.a.r.l.SimpleMessageListenerContainer : Successfully waited for workers to finish.
2019-06-11 09:15:14.257 INFO 96620 --- [ Thread-2] o.s.a.r.l.SimpleMessageListenerContainer : Shutdown ignored - container is not active already
Related
What is wrong with this Config ? I am not able to overwrite an existing file in the sftp server location (new and old file name are the same). the directory has 777 as chmod too. I have added the error logs below. I have attached the atmoz dockercompose file for you to analyze this issue.
#Bean
#ServiceActivator(inputChannel = "toSftpChannel")
public MessageHandler toSftpChannelHandler() {
SftpOutboundGateway sftpOutboundGateway =
new SftpOutboundGateway(
sftpDestinationSessionFactory(),
AbstractRemoteFileOutboundGateway.Command.PUT.getCommand(),
"headers['remote-target-dir']");
sftpOutboundGateway.setRemoteDirectoryExpression(PARSER.parseExpression("headers['remote-target-dir']"));
sftpOutboundGateway.setUseTemporaryFileName(true);
sftpOutboundGateway.setTemporaryFileSuffix(".temp");
sftpOutboundGateway.setFileExistsMode(FileExistsMode.REPLACE);
sftpOutboundGateway.setOutputChannelName("deleteLocalFilesChannel");
sftpOutboundGateway.setAdviceChain(List.of(retryAdvice));
return sftpOutboundGateway;
}
file_remoteFile=SampleIntegrationFile.txt, timestamp=1675720242276}]
2023-02-07T07:55:18.854+10:00 INFO 9752 --- [ scheduling-1] c.d.s.sftpTosftp.middle.ProcessMessage : Input File Path: C:\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt
2023-02-07T07:55:18.854+10:00 INFO 9752 --- [ scheduling-1] c.d.s.sftpTosftp.middle.ProcessMessage : Input File Headers: [file_remoteHostPort=localhost:22, file_name=SampleIntegrationFile.txt, file_remoteDirectory=//sftp/Outgoing/sftpToSftp/, file_originalFile=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, id=35841395-ac31-6636-966c-fc3cc0d04329, file_relativePath=SampleIntegrationFile.txt, file_remoteFile=SampleIntegrationFile.txt, timestamp=1675720518854]
2023-02-07T07:55:18.854+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Retry: count=0
2023-02-07T07:55:21.891+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Checking for rethrow: count=1
2023-02-07T07:55:21.891+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Retry: count=1
2023-02-07T07:55:21.916+10:00 WARN 9752 --- []-nio2-thread-2] o.a.s.c.k.AcceptAllServerKeyVerifier : Server at localhost/127.0.0.1:22 presented unverified RSA key: SHA256:kQ7FBDG5+ZBmGHEsYW4RQmhmKHptYsN0MsAeQ7Cx1So
2023-02-07T07:55:22.014+10:00 WARN 9752 --- [-nio2-thread-13] o.a.s.c.session.ClientConnectionService : globalRequest(ClientConnectionService[ClientSessionImpl[admin#localhost/127.0.0.1:22]])[hostkeys-00#openssh.com, want-reply=false] failed (SshException) to process: EdDSA provider not supported
2023-02-07T07:55:25.250+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Checking for rethrow: count=2
2023-02-07T07:55:25.250+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Retry: count=2
2023-02-07T07:55:25.271+10:00 WARN 9752 --- []-nio2-thread-4] o.a.s.c.k.AcceptAllServerKeyVerifier : Server at localhost/127.0.0.1:22 presented unverified RSA key: SHA256:kQ7FBDG5+ZBmGHEsYW4RQmhmKHptYsN0MsAeQ7Cx1So
2023-02-07T07:55:25.327+10:00 WARN 9752 --- [-nio2-thread-13] o.a.s.c.session.ClientConnectionService : globalRequest(ClientConnectionService[ClientSessionImpl[admin#localhost/127.0.0.1:22]])[hostkeys-00#openssh.com, want-reply=false] failed (SshException) to process: EdDSA provider not supported
2023-02-07T07:55:28.561+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Checking for rethrow: count=3
2023-02-07T07:55:28.561+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Retry: count=3
2023-02-07T07:55:28.584+10:00 WARN 9752 --- []-nio2-thread-8] o.a.s.c.k.AcceptAllServerKeyVerifier : Server at localhost/127.0.0.1:22 presented unverified RSA key: SHA256:kQ7FBDG5+ZBmGHEsYW4RQmhmKHptYsN0MsAeQ7Cx1So
2023-02-07T07:55:28.683+10:00 WARN 9752 --- [-nio2-thread-13] o.a.s.c.session.ClientConnectionService : globalRequest(ClientConnectionService[ClientSessionImpl[admin#localhost/127.0.0.1:22]])[hostkeys-00#openssh.com, want-reply=false] failed (SshException) to process: EdDSA provider not supported
2023-02-07T07:55:31.958+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Checking for rethrow: count=4
2023-02-07T07:55:31.958+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Retry: count=4
2023-02-07T07:55:31.979+10:00 WARN 9752 --- [-nio2-thread-10] o.a.s.c.k.AcceptAllServerKeyVerifier : Server at localhost/127.0.0.1:22 presented unverified RSA key: SHA256:kQ7FBDG5+ZBmGHEsYW4RQmhmKHptYsN0MsAeQ7Cx1So
2023-02-07T07:55:32.072+10:00 WARN 9752 --- [-nio2-thread-13] o.a.s.c.session.ClientConnectionService : globalRequest(ClientConnectionService[ClientSessionImpl[admin#localhost/127.0.0.1:22]])[hostkeys-00#openssh.com, want-reply=false] failed (SshException) to process: EdDSA provider not supported
2023-02-07T07:55:32.315+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Checking for rethrow: count=5
2023-02-07T07:55:32.315+10:00 DEBUG 9752 --- [ scheduling-1] o.s.retry.support.RetryTemplate : Retry failed last attempt: count=5
2023-02-07T07:55:32.318+10:00 ERROR 9752 --- [ scheduling-1] o.s.integration.handler.LoggingHandler : org.springframework.messaging.MessagingException: Failed to handle, failedMessage=GenericMessage [payload=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, headers={file_remoteHostPort=localhost:22, file_name=SampleIntegrationFile.txt, file_remoteDirectory=//sftp/Outgoing/sftpToSftp/, remote-target-dir=/sftp/Incoming/sftpToSftp/, file_originalFile=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, id=cd33b5fa-4fab-93c3-d46a-5955f858ce0a, file_relativePath=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, file_remoteFile=SampleIntegrationFile.txt, timestamp=1675720518854}]
at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$CallbackImpl.cloneAndExecute(AbstractRequestHandlerAdvice.java:175)
at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.lambda$doInvoke$1(RequestHandlerRetryAdvice.java:86)
at org.springframework.retry.support.RetryTemplate.doExecute(RetryTemplate.java:329)
at org.springframework.retry.support.RetryTemplate.execute(RetryTemplate.java:255)
at org.springframework.integration.handler.advice.RequestHandlerRetryAdvice.doInvoke(RequestHandlerRetryAdvice.java:86)
at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice.invoke(AbstractRequestHandlerAdvice.java:67)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:184)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:218)
at jdk.proxy3/jdk.proxy3.$Proxy60.handleRequestMessage(Unknown Source)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.doInvokeAdvisedRequestHandler(AbstractReplyProducingMessageHandler.java:155)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:139)
at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:105)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:133)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:106)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72)
at org.springframework.integration.channel.AbstractMessageChannel.sendInternal(AbstractMessageChannel.java:373)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:327)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:297)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutput(AbstractMessageProducingHandler.java:484)
at org.springframework.integration.handler.AbstractMessageProducingHandler.doProduceOutput(AbstractMessageProducingHandler.java:339)
at org.springframework.integration.handler.AbstractMessageProducingHandler.produceOutput(AbstractMessageProducingHandler.java:268)
at org.springframework.integration.handler.AbstractMessageProducingHandler.sendOutputs(AbstractMessageProducingHandler.java:232)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler.handleMessageInternal(AbstractReplyProducingMessageHandler.java:142)
at org.springframework.integration.handler.AbstractMessageHandler.doHandleMessage(AbstractMessageHandler.java:105)
at org.springframework.integration.handler.AbstractMessageHandler.handleMessage(AbstractMessageHandler.java:73)
at org.springframework.integration.dispatcher.AbstractDispatcher.tryOptimizedDispatch(AbstractDispatcher.java:115)
at org.springframework.integration.dispatcher.UnicastingDispatcher.doDispatch(UnicastingDispatcher.java:133)
at org.springframework.integration.dispatcher.UnicastingDispatcher.dispatch(UnicastingDispatcher.java:106)
at org.springframework.integration.channel.AbstractSubscribableChannel.doSend(AbstractSubscribableChannel.java:72)
at org.springframework.integration.channel.AbstractMessageChannel.sendInternal(AbstractMessageChannel.java:373)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:327)
at org.springframework.integration.channel.AbstractMessageChannel.send(AbstractMessageChannel.java:297)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:187)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:166)
at org.springframework.messaging.core.GenericMessagingTemplate.doSend(GenericMessagingTemplate.java:47)
at org.springframework.messaging.core.AbstractMessageSendingTemplate.send(AbstractMessageSendingTemplate.java:109)
at org.springframework.integration.endpoint.SourcePollingChannelAdapter.handleMessage(SourcePollingChannelAdapter.java:196)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.messageReceived(AbstractPollingEndpoint.java:474)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.doPoll(AbstractPollingEndpoint.java:460)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.pollForMessage(AbstractPollingEndpoint.java:412)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$4(AbstractPollingEndpoint.java:348)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.lambda$execute$0(ErrorHandlingTaskExecutor.java:57)
at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:50)
at org.springframework.integration.util.ErrorHandlingTaskExecutor.execute(ErrorHandlingTaskExecutor.java:55)
at org.springframework.integration.endpoint.AbstractPollingEndpoint.lambda$createPoller$5(AbstractPollingEndpoint.java:341)
at org.springframework.scheduling.support.DelegatingErrorHandlingRunnable.run(DelegatingErrorHandlingRunnable.java:54)
at org.springframework.scheduling.concurrent.ReschedulingRunnable.run(ReschedulingRunnable.java:96)
at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
at java.base/java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.springframework.messaging.MessageDeliveryException: Error handling message for file [C:\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt -> SampleIntegrationFile.txt], failedMessage=GenericMessage [payload=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, headers={file_remoteHostPort=localhost:22, file_name=SampleIntegrationFile.txt, file_remoteDirectory=//sftp/Outgoing/sftpToSftp/, remote-target-dir=/sftp/Incoming/sftpToSftp/, file_originalFile=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, id=cd33b5fa-4fab-93c3-d46a-5955f858ce0a, file_relativePath=\tmp\sftp-inbound\sftpToSftpData\SampleIntegrationFile.txt, file_remoteFile=SampleIntegrationFile.txt, timestamp=1675720518854}]
at org.springframework.integration.file.remote.RemoteFileTemplate.doSend(RemoteFileTemplate.java:367)
at org.springframework.integration.file.remote.RemoteFileTemplate.lambda$send$0(RemoteFileTemplate.java:314)
at org.springframework.integration.file.remote.RemoteFileTemplate.execute(RemoteFileTemplate.java:452)
at org.springframework.integration.file.remote.RemoteFileTemplate.send(RemoteFileTemplate.java:314)
at org.springframework.integration.file.remote.RemoteFileTemplate.send(RemoteFileTemplate.java:302)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.put(AbstractRemoteFileOutboundGateway.java:831)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.lambda$doPut$13(AbstractRemoteFileOutboundGateway.java:817)
at org.springframework.integration.file.remote.RemoteFileTemplate.invoke(RemoteFileTemplate.java:484)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doPut(AbstractRemoteFileOutboundGateway.java:816)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.doPut(AbstractRemoteFileOutboundGateway.java:812)
at org.springframework.integration.file.remote.gateway.AbstractRemoteFileOutboundGateway.handleRequestMessage(AbstractRemoteFileOutboundGateway.java:589)
at org.springframework.integration.handler.AbstractReplyProducingMessageHandler$AdvisedRequestHandler.handleRequestMessage(AbstractReplyProducingMessageHandler.java:208)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:343)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:196)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163)
at org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice$CallbackImpl.cloneAndExecute(AbstractRequestHandlerAdvice.java:166)
... 58 more
Caused by: org.springframework.messaging.MessagingException: Failed to write to '/sftp/Incoming/sftpToSftp/SampleIntegrationFile.txt.temp' while uploading the file
at org.springframework.integration.file.remote.RemoteFileTemplate.sendFileToRemoteDirectory(RemoteFileTemplate.java:573)
at org.springframework.integration.file.remote.RemoteFileTemplate.doSend(RemoteFileTemplate.java:353)
... 77 more
Caused by: SFTP error (SSH_FX_FAILURE): Failure
at org.apache.sshd.sftp.client.impl.AbstractSftpClient.throwStatusException(AbstractSftpClient.java:217)
at org.apache.sshd.sftp.client.impl.AbstractSftpClient.checkResponseStatus(AbstractSftpClient.java:212)
at org.apache.sshd.sftp.client.impl.AbstractSftpClient.checkResponseStatus(AbstractSftpClient.java:186)
at org.apache.sshd.sftp.client.impl.AbstractSftpClient.checkCommandStatus(AbstractSftpClient.java:164)
at org.apache.sshd.sftp.client.impl.AbstractSftpClient.rename(AbstractSftpClient.java:647)
at org.apache.sshd.sftp.client.SftpClient.rename(SftpClient.java:617)
at org.springframework.integration.sftp.session.SftpSession.rename(SftpSession.java:162)
at org.springframework.integration.file.remote.session.CachingSessionFactory$CachedSession.rename(CachingSessionFactory.java:252)
at org.springframework.integration.file.remote.RemoteFileTemplate.doSend(RemoteFileTemplate.java:606)
at org.springframework.integration.file.remote.RemoteFileTemplate.sendFileToRemoteDirectory(RemoteFileTemplate.java:570)
My Atmoz dockercompose file
I have try to deploy my app to Heroku, but it's not working. I have try to follow the vaadin instructions, but it's not working. What's the problem?
Error on heroku logs:
Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener]
java.lang.RuntimeException: Unable to initialize com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener
2023-01-04T22:30:36.972557+00:00 app[web.1]: at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:192) ~[vaadin-spring-23.3.0.jar!/:na]
2023-01-04T22:30:36.972560+00:00 app[web.1]: at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.lambda$contextInitialized$0(VaadinServletContextInitializer.java:214) ~[vaadin-spring-23.3.0.jar!/:na]
2023-01-04T22:30:36.972561+00:00 app[web.1]: at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) ~[na:na]
2023-01-04T22:30:36.972562+00:00 app[web.1]: at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:214) ~[vaadin-spring-23.3.0.jar!/:na]
...
2023-01-04T20:56:40.962495+00:00 app[web.1]: 2023-01-04 21:56:40.962 INFO 4 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 35531 (http)
2023-01-04T20:56:40.981852+00:00 app[web.1]: 2023-01-04 21:56:40.981 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2023-01-04T20:56:40.982068+00:00 app[web.1]: 2023-01-04 21:56:40.981 INFO 4 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.68]
2023-01-04T20:56:41.145481+00:00 app[web.1]: 2023-01-04 21:56:41.145 INFO 4 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2023-01-04T20:56:41.145634+00:00 app[web.1]: 2023-01-04 21:56:41.145 INFO 4 --- [ main] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 4610 ms
2023-01-04T20:56:41.391728+00:00 app[web.1]: 2023-01-04 21:56:41.391 ERROR 4 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener]
2023-01-04T20:56:41.391750+00:00 app[web.1]:
2023-01-04T20:56:41.391753+00:00 app[web.1]: java.lang.RuntimeException: Unable to initialize com.vaadin.flow.spring.VaadinServletContextInitializer$VaadinAppShellContextListener
2023-01-04T20:56:41.391773+00:00 app[web.1]: at com.vaadin.flow.spring.VaadinServletContextInitializer$FailFastServletContextListener.contextInitialized(VaadinServletContextInitializer.java:192) ~[vaadin-spring-23.3.0.jar!/:na]
2023-01-04T20:56:41.391775+00:00 app[web.1]: at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.lambda$contextInitialized$0(VaadinServletContextInitializer.java:214) ~[vaadin-spring-23.3.0.jar!/:na]
2023-01-04T20:56:41.391776+00:00 app[web.1]: at java.base/java.util.ArrayList.forEach(ArrayList.java:1541) ~[na:na]
2023-01-04T20:56:41.391776+00:00 app[web.1]: at com.vaadin.flow.spring.VaadinServletContextInitializer$CompositeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:214) ~[vaadin-spring-23.3.0.jar!/:na]
2023-01-04T20:56:41.391778+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4767) ~[tomcat-embed-core-9.0.68.jar!/:na]
2023-01-04T20:56:41.391778+00:00 app[web.1]: at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5231) ~[tomcat-embed-core-9.0.68.jar!/:na]
2023-01-04T20:56:41.391779+00:00 app[web.1]: at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.68.jar!/:na]
2023-01-04T20:56:41.391779+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396) ~[tomcat-embed-core-9.0.68.jar!/:na]
2023-01-04T20:56:41.391780+00:00 app[web.1]: at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386) ~[tomcat-embed-core-9.0.68.jar!/:na]
...
2023-01-04T20:56:41.391815+00:00 app[web.1]: ... 50 common frames omitted
2023-01-04T20:56:41.391815+00:00 app[web.1]:
2023-01-04T20:56:41.392195+00:00 app[web.1]: 2023-01-04 21:56:41.392 ERROR 4 --- [ main] o.apache.catalina.core.StandardContext : One or more listeners failed to start. Full details will be found in the appropriate container log file
2023-01-04T20:56:41.392932+00:00 app[web.1]: 2023-01-04 21:56:41.392 ERROR 4 --- [ main] o.apache.catalina.core.StandardContext : Context [] startup failed due to previous errors
2023-01-04T20:56:41.446993+00:00 app[web.1]: 2023-01-04 21:56:41.446 INFO 4 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2023-01-04T20:56:41.452376+00:00 app[web.1]: 2023-01-04 21:56:41.452 WARN 4 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2023-01-04T20:56:41.464604+00:00 app[web.1]: 2023-01-04 21:56:41.464 INFO 4 --- [ main] ConditionEvaluationReportLoggingListener :
2023-01-04T20:56:41.464605+00:00 app[web.1]:
2023-01-04T20:56:41.464606+00:00 app[web.1]: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2023-01-04T20:56:41.509555+00:00 app[web.1]: 2023-01-04 21:56:41.509 ERROR 4 --- [ main] o.s.boot.SpringApplication : Application run failed
...
2023-01-04T20:56:41.509566+00:00 app[web.1]: Caused by: org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat
2023-01-04T20:56:41.509566+00:00 app[web.1]: at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:142) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509566+00:00 app[web.1]: at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.<init>(TomcatWebServer.java:104) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509567+00:00 app[web.1]: at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getTomcatWebServer(TomcatServletWebServerFactory.java:479) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509567+00:00 app[web.1]: at org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory.getWebServer(TomcatServletWebServerFactory.java:211) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509568+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:184) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509568+00:00 app[web.1]: at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:162) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509569+00:00 app[web.1]: ... 17 common frames omitted
2023-01-04T20:56:41.509569+00:00 app[web.1]: Caused by: java.lang.IllegalStateException: StandardEngine[Tomcat].StandardHost[localhost].TomcatEmbeddedContext[] failed to start
2023-01-04T20:56:41.509570+00:00 app[web.1]: at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.rethrowDeferredStartupExceptions(TomcatWebServer.java:187) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509570+00:00 app[web.1]: at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.initialize(TomcatWebServer.java:126) ~[spring-boot-2.7.5.jar!/:2.7.5]
2023-01-04T20:56:41.509570+00:00 app[web.1]: ... 22 common frames omitted
2023-01-04T20:56:41.509571+00:00 app[web.1]:
2023-01-04T20:56:41.752738+00:00 heroku[web.1]: State changed from starting to crashed
On my computer is working perfectly and i don't receive any error message.
I have been working on a banking project. I have a problem that is about RabbitMQ and Docker.
I have two microservices that are called query and command. Both of them can not connect to my RabbitMq container. I have been trying to solve this problem, but I could not.
I can succesfully connect and open http://localhost:15672/#/ after docker compose.
When I run docker compose up, account-cmd and account-query services not running on the browser. Here is my docker-compose.yml file.
version: "3.4"
services:
customerdb:
container_name: customerdb
image: postgres
environment:
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
POSTGRES_USER: ${POSTGRES_USER:-postgres}
volumes:
- ./customer/postgres_init.sql:/docker-entrypoint-initdb.d/postgres_init.sql
ports:
- "5432:5432"
restart: unless-stopped
querydb:
container_name: querydb
image: postgres
environment:
POSTGRES_USER: ${POSTGRES_USER:-postgres}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-postgres}
volumes:
- ./account.query/postgres_init.sql:/docker-entrypoint-initdb.d/postgres_init.sql
ports:
- "5433:5432"
restart: unless-stopped
rabbitmq:
container_name: "bank_rabbitmq"
image: "rabbitmq:3.8-management"
hostname: "rabbitmq"
environment:
RABBITMQ_DEFAULT_USER: "guest"
RABBITMQ_DEFAULT_PASS: "guest"
RABBITMQ_DEFAULT_VHOST: "/"
ports:
- "15672:15672"
- "5672:5672"
cmddb:
container_name: "cmddb"
image: mongo
restart: always
ports:
- "27017:27017"
customer-service:
image: bank/customer-service-api
container_name: customer-service
build:
context: ./customer
dockerfile: Dockerfile
ports:
- "5000:5000"
depends_on:
- customerdb
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://customerdb:5432/customerdb
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
account-cmd:
image: bank/account-cmd-service-api
container_name: account-cmd-service
build:
context: ./account.cmd
dockerfile: Dockerfile
ports:
- "5002:5002"
depends_on:
- cmddb
- rabbitmq
environment:
- SPRING_DATA_MONGODB_HOST=cmddb
- SPRING_DATA_MONGODB_PORT=27017
- SPRING_DATA_MONGODB_DATABASE=accountcmdb
- SPRING_RABBITMQ_HOST=rabbitmq
- SPRING_RABBITMQ_PORT=5672
- SPRING_RABBITMQ_USERNAME=guest
- SPRING_RABBITMQ_PASSWORD=guest
account-query:
image: bank/account-query-service-api
container_name: account-query-service
build:
context: ./account.query
dockerfile: Dockerfile
ports:
- "5003:5003"
depends_on:
- querydb
- rabbitmq
environment:
- SPRING_DATASOURCE_URL=jdbc:postgresql://querydb:5433/accountingdb
- SPRING_DATASOURCE_USERNAME=postgres
- SPRING_DATASOURCE_PASSWORD=postgres
- SPRING_RABBITMQ_HOST=rabbitmq
- SPRING_RABBITMQ_PORT=5672
- SPRING_RABBITMQ_USERNAME=guest
- SPRING_RABBITMQ_PASSWORD=guest
volumes:
customerdb:
cmddb:
querydb:
Here is my RabbitMQConfig on spring boot.
package com.bankingsolution.account.query.configuration;
import com.bankingsolution.common.constants.Contants;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.amqp.rabbit.annotation.RabbitListenerConfigurer;
import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory;
import org.springframework.amqp.rabbit.connection.CachingConnectionFactory;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.amqp.rabbit.listener.RabbitListenerEndpointRegistrar;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.converter.MappingJackson2MessageConverter;
import org.springframework.messaging.handler.annotation.support.DefaultMessageHandlerMethodFactory;
import java.util.Arrays;
import java.util.List;
#Configuration
public class RabbitMQConfig implements RabbitListenerConfigurer {
#Value("${spring.rabbitmq.host}")
private String hostName;
#Value("${spring.rabbitmq.username}")
private String userName;
#Value("${spring.rabbitmq.password}")
private String password;
#Value("${spring.rabbitmq.port}")
private int port;
#Bean
public TopicExchange exchange() {
return new TopicExchange(Contants.TOPIC_KEY);
}
#Bean
Queue accountOpenedQueue() {
return new Queue(Contants.AccountOpenedTopic);
}
#Bean
Queue fundsDepositedQueue() {
return new Queue(Contants.FundsDepositedTopic);
}
#Bean
Queue fundsWithdrawnQueue() {
return new Queue(Contants.FundsWithDrawnTopic);
}
#Bean
Queue transactionCreatedQueue() {
return new Queue(Contants.TransactionCreatedTopic);
}
#Bean
Queue transactionFailedQueue() {
return new Queue(Contants.TransactionFailedTopic);
}
#Bean
public List<Binding> binding() {
return Arrays.asList(
BindingBuilder.bind(accountOpenedQueue()).to(exchange()).with(Contants.AccountOpenedTopic),
BindingBuilder.bind(fundsDepositedQueue()).to(exchange()).with(Contants.FundsDepositedTopic),
BindingBuilder.bind(fundsWithdrawnQueue()).to(exchange()).with(Contants.FundsWithDrawnTopic),
BindingBuilder.bind(transactionCreatedQueue()).to(exchange()).with(Contants.TransactionCreatedTopic),
BindingBuilder.bind(transactionFailedQueue()).to(exchange()).with(Contants.TransactionFailedTopic));
}
#Bean
public MessageConverter jsonMessageConverter() {
return new Jackson2JsonMessageConverter();
}
#Bean
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory() {
SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
factory.setConnectionFactory(connectionFactory());
return factory;
}
#Bean
public ConnectionFactory connectionFactory() {
CachingConnectionFactory connectionFactory = new CachingConnectionFactory();
connectionFactory.setHost(this.hostName);
connectionFactory.setVirtualHost("/");
connectionFactory.setUsername(this.userName);
connectionFactory.setPassword(this.password);
connectionFactory.setPort(this.port);
return connectionFactory;
}
#Override
public void configureRabbitListeners(RabbitListenerEndpointRegistrar registrar) {
registrar.setMessageHandlerMethodFactory(myHandlerMethodFactory());
}
#Bean
public DefaultMessageHandlerMethodFactory myHandlerMethodFactory() {
DefaultMessageHandlerMethodFactory factory = new DefaultMessageHandlerMethodFactory();
factory.setMessageConverter(new MappingJackson2MessageConverter());
return factory;
}
}
Here is sample error on Docker for a microservice.
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueInfo(RabbitAdmin.java:463) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:447) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.attemptDeclarations(AbstractMessageListenerContainer.java:1925) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1906) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.initialize(SimpleMessageListenerContainer.java:1349) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1195) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:na]
at java.base/java.net.SocksSocketImpl.connect(Unknown Source) ~[na:na]
at java.base/java.net.Socket.connect(Unknown Source) ~[na:na]
at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.13.1.jar!/:5.13.1]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1223) ~[amqp-client-5.13.1.jar!/:5.13.1]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1173) ~[amqp-client-5.13.1.jar!/:5.13.1]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connectAddresses(AbstractConnectionFactory.java:640) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connect(AbstractConnectionFactory.java:615) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:565) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
... 12 common frames omitted
2022-03-22 01:07:40.006 INFO 1 --- [ntContainer#4-3] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq:5672]
2022-03-22 01:07:40.006 INFO 1 --- [ntContainer#4-2] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq:5672]
2022-03-22 01:07:40.007 ERROR 1 --- [ntContainer#4-2] o.s.a.r.l.SimpleMessageListenerContainer : Failed to check/redeclare auto-delete queue(s).
org.springframework.amqp.AmqpConnectException: java.net.ConnectException: Connection refused (Connection refused)
at org.springframework.amqp.rabbit.support.RabbitExceptionTranslator.convertRabbitAccessException(RabbitExceptionTranslator.java:61) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:602) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.CachingConnectionFactory.createConnection(CachingConnectionFactory.java:724) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.ConnectionFactoryUtils.createConnection(ConnectionFactoryUtils.java:252) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.core.RabbitTemplate.doExecute(RabbitTemplate.java:2175) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2148) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.core.RabbitTemplate.execute(RabbitTemplate.java:2128) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueInfo(RabbitAdmin.java:463) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.core.RabbitAdmin.getQueueProperties(RabbitAdmin.java:447) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.attemptDeclarations(AbstractMessageListenerContainer.java:1925) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.AbstractMessageListenerContainer.redeclareElementsIfNecessary(AbstractMessageListenerContainer.java:1906) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.initialize(SimpleMessageListenerContainer.java:1349) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer$AsyncMessageProcessingConsumer.run(SimpleMessageListenerContainer.java:1195) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at java.base/java.lang.Thread.run(Unknown Source) ~[na:na]
Caused by: java.net.ConnectException: Connection refused (Connection refused)
at java.base/java.net.PlainSocketImpl.socketConnect(Native Method) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:na]
at java.base/java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:na]
at java.base/java.net.SocksSocketImpl.connect(Unknown Source) ~[na:na]
at java.base/java.net.Socket.connect(Unknown Source) ~[na:na]
at com.rabbitmq.client.impl.SocketFrameHandlerFactory.create(SocketFrameHandlerFactory.java:60) ~[amqp-client-5.13.1.jar!/:5.13.1]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1223) ~[amqp-client-5.13.1.jar!/:5.13.1]
at com.rabbitmq.client.ConnectionFactory.newConnection(ConnectionFactory.java:1173) ~[amqp-client-5.13.1.jar!/:5.13.1]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connectAddresses(AbstractConnectionFactory.java:640) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.connect(AbstractConnectionFactory.java:615) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
at org.springframework.amqp.rabbit.connection.AbstractConnectionFactory.createBareConnection(AbstractConnectionFactory.java:565) ~[spring-rabbit-2.4.2.jar!/:2.4.2]
... 12 common frames omitted
2022-03-22 01:07:40.008 INFO 1 --- [ntContainer#4-2] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq:5672]
2022-03-22 01:07:40.023 INFO 1 --- [ main] c.b.account.query.QueryApplication : Started QueryApplication in 8.535 seconds (JVM running for 9.399)
2022-03-22 01:07:44.965 WARN 1 --- [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-03-22 01:07:44.965 WARN 1 --- [ntContainer#0-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)
2022-03-22 01:07:44.966 WARN 1 --- [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-03-22 01:07:44.966 WARN 1 --- [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-03-22 01:07:44.969 INFO 1 --- [ntContainer#0-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#27755487: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.969 INFO 1 --- [ntContainer#0-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#2e5b7fba: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.969 INFO 1 --- [ntContainer#0-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#4f0cab0a: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.969 INFO 1 --- [ntContainer#0-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#60d40ff4: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.970 INFO 1 --- [ntContainer#0-5] o.s.a.r.c.CachingConnectionFactory : Attempting to connect to: [rabbitmq:5672]
2022-03-22 01:07:44.971 WARN 1 --- [ntContainer#1-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)
2022-03-22 01:07:44.971 INFO 1 --- [ntContainer#1-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#6fc6deb7: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.973 WARN 1 --- [ntContainer#1-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-03-22 01:07:44.973 INFO 1 --- [ntContainer#1-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#7da39774: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.976 WARN 1 --- [ntContainer#1-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-03-22 01:07:44.979 INFO 1 --- [ntContainer#1-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#367f0121: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.979 WARN 1 --- [ntContainer#1-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-03-22 01:07:44.979 INFO 1 --- [ntContainer#1-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#441b8382: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.982 WARN 1 --- [ntContainer#2-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)
2022-03-22 01:07:44.982 INFO 1 --- [ntContainer#2-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#39bbd9e0: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.984 WARN 1 --- [ntContainer#2-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-03-22 01:07:44.984 INFO 1 --- [ntContainer#2-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#4397a639: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.986 WARN 1 --- [ntContainer#2-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-03-22 01:07:44.986 INFO 1 --- [ntContainer#2-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#27fe9713: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.988 WARN 1 --- [ntContainer#2-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-03-22 01:07:44.988 INFO 1 --- [ntContainer#2-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#11c3ff67: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.994 WARN 1 --- [ntContainer#3-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)
2022-03-22 01:07:44.999 WARN 1 --- [ntContainer#3-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-03-22 01:07:44.999 WARN 1 --- [ntContainer#3-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-03-22 01:07:44.999 INFO 1 --- [ntContainer#3-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#3e4e4c1: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.999 INFO 1 --- [ntContainer#3-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#46a488c2: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:44.999 INFO 1 --- [ntContainer#3-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#3ae126d1: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:45.000 WARN 1 --- [ntContainer#3-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-03-22 01:07:45.000 INFO 1 --- [ntContainer#3-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#7e7f3cfd: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:45.004 WARN 1 --- [ntContainer#4-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)
2022-03-22 01:07:45.005 INFO 1 --- [ntContainer#4-1] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#49d831c2: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:45.008 WARN 1 --- [ntContainer#4-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-03-22 01:07:45.009 INFO 1 --- [ntContainer#4-4] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#28bdbe88: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:45.010 WARN 1 --- [ntContainer#4-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-03-22 01:07:45.010 INFO 1 --- [ntContainer#4-3] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#43fda8d9: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:45.011 WARN 1 --- [ntContainer#4-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-03-22 01:07:45.011 INFO 1 --- [ntContainer#4-2] o.s.a.r.l.SimpleMessageListenerContainer : Restarting Consumer#53a7a60c: tags=[[]], channel=null, acknowledgeMode=AUTO local queue size=0
2022-03-22 01:07:45.038 INFO 1 --- [ntContainer#0-5] o.s.a.r.c.CachingConnectionFactory : Created new connection: rabbitConnectionFactory#51abf713:45/SimpleConnection#427bde5e [delegate=amqp://rabbitmq#172.23.0.5:5672/, localPort= 54968]
I would be very happy if someone could help.
Here is my github repository.
https://github.com/dogaanismail/bank-solution
I was able to start it properly with same configuration and port, however suddenly its unable to start with below log. As per the log, its a Caused by: java.net.SocketException: Permission denied
However I am surprised that nothing has changed then how suddenly I am getting permission denied, not getting any further clue, can someone suggest please
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.2.7.RELEASE)
2021-02-03 10:09:32.282 INFO 26951 --- [ main] c.p.w.e.WebhookEndpointApplication : Starting WebhookEndpointApplication v1.0.0 on ip-172-31-2
6-225.eu-central-1.compute.internal with PID 26951 (/home/ec2-user/webhook-app/webhook-endpoint/target/webhook-endpoint-1.0.0.jar started by ec2-user in /home
/ec2-user/webhook-app/webhook-endpoint)
2021-02-03 10:09:32.286 INFO 26951 --- [ main] c.p.w.e.WebhookEndpointApplication : No active profile set, falling back to default profiles:
default
2021-02-03 10:09:33.424 INFO 26951 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data MongoDB repositories in DEFAULT
mode.
2021-02-03 10:09:33.504 INFO 26951 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 72ms. Found 1
MongoDB repository interfaces.
2021-02-03 10:09:34.267 INFO 26951 --- [ main] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 80 (http)
2021-02-03 10:09:34.283 INFO 26951 --- [ main] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2021-02-03 10:09:34.284 INFO 26951 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.34]
2021-02-03 10:09:34.412 INFO 26951 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2021-02-03 10:09:34.412 INFO 26951 --- [ main] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2
017 ms
2021-02-03 10:09:34.756 INFO 26951 --- [ main] org.mongodb.driver.cluster : Cluster created with settings {hosts=[localhost:27017], m
ode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
2021-02-03 10:09:34.981 INFO 26951 --- [localhost:27017] org.mongodb.driver.connection : Opened connection [connectionId{localValue:1, serverValue
:11}] to localhost:27017
2021-02-03 10:09:34.990 INFO 26951 --- [localhost:27017] org.mongodb.driver.cluster : Monitor thread successfully connected to server with desc
ription ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[4, 2, 8]}, minWireVersion=0,
maxWireVersion=8, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=6701667}
2021-02-03 10:09:35.550 INFO 26951 --- [ main] o.s.s.concurrent.ThreadPoolTaskExecutor : Initializing ExecutorService 'applicationTaskExecutor'
2021-02-03 10:09:35.793 INFO 26951 --- [ main] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2021-02-03 10:09:35.802 INFO 26951 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-02-03 10:09:35.808 ERROR 26951 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.boot.web.server.WebServerException: Unable to start embedded Tomcat server
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:212) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:297) ~[sprin
g-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:163) ~[spring
-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:553) ~[spring-context-5.2.6.RELEASE.jar!/:5.
2.6.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:141) ~[spring-boot-
2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1215) [spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
at com.payon.webhook.endpoint.WebhookEndpointApplication.main(WebhookEndpointApplication.java:10) [classes!/:1.0.0]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_252]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_252]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_252]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_252]
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [webhook-endpoint-1.0.0.jar:1.0.0]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [webhook-endpoint-1.0.0.jar:1.0.0]
at org.springframework.boot.loader.Launcher.launch(Launcher.java:51) [webhook-endpoint-1.0.0.jar:1.0.0]
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:52) [webhook-endpoint-1.0.0.jar:1.0.0]
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:231) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:265) ~[spring-boot-2.2.7.RELEASE.j
ar!/:2.2.7.RELEASE]
at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:196) ~[spring-boot-2.2.7.RELEASE.jar!/:2.2.7.RELEASE]
... 18 common frames omitted
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1066) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.catalina.core.StandardService.addConnector(StandardService.java:227) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
... 20 common frames omitted
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_252]
at sun.nio.ch.Net.bind(Net.java:433) ~[na:1.8.0_252]
at sun.nio.ch.Net.bind(Net.java:425) ~[na:1.8.0_252]
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:220) ~[na:1.8.0_252]
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:85) ~[na:1.8.0_252]
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:228) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:211) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1141) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1227) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:592) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
at org.apache.catalina.connector.Connector.startInternal(Connector.java:1063) ~[tomcat-embed-core-9.0.34.jar!/:9.0.34]
... 22 common frames omitted
You can look at this answer: Spring Boot deploy with Tomcat.
In my case; i included the tomcat dependency in the pom file;and I use 8080 as the server pot; which solves my issue.
In addition, don't forget to check your jre and jdk version.
I'm working on Spring Boot project. I have class as you see below. When i run project it give me error like that "Unable to open JDBC Connection for DDL execution". I know that my problem depent to "annotation". How can reach good solution which have got true annotation?
for Tweet table:
'''
#Entity
#Table(name = "tweet")
public class Tweet {
#Id
#Column(name = "ID")
#GeneratedValue
private long id;
private String tweetID;
private String parentTweetID;
private String avatar;
private String owner_name;
private String owner_nick;
private String content;
private String sent_time;
private String sent_date;
private String retweet_count;
private String like_count;
private String owner_link;
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "thread_id")
private Thread thread;
#OneToMany(fetch = FetchType.LAZY,mappedBy = "tweet")
private List<Media> mediaURLs;
....(getter/setter)
}
for Thread Table:
#Entity
public class Thread {
#Id
#Column(name = "ID")
#GeneratedValue
private Long id;
#OneToMany(fetch = FetchType.LAZY,mappedBy = "thread")
private List<Tweet> listOfTweets;
.....(getter/setter)
}
for Media table:
#Entity
#Table(name="media")
public class Media {
#Id
#Column(name = "ID")
#GeneratedValue
private long id;
private String mediaID;
private String mediaType;
private String mediaUrl;
private String mediaUrlHttps;
private String mediaVideoUrl;
#ManyToOne(fetch = FetchType.LAZY)
#JoinColumn(name = "tweetID")
private Tweet tweet;
.....(getter/setter)
}
Actually i expect result like that.
https://prnt.sc/mj7nxq
application.properties file:
spring.datasource.url=jdbc:mysql://localhost:3306/tweetdb?useUnicode=true&characterEncoding=utf8&useSSL=false
spring.datasource.username=tweet
spring.datasource.password=root
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.show-sql=true
spring.jpa.hibernate.ddl-auto=update
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
spring.thymeleaf.templates_root=src/main/resources/templates/
logging.level.org.springframework.web= DEBUG
logging.level.com.savetweet= DEBUG
logging.level.org.hibernate= ERROR
Output:
2019-02-10 21:09:03.662 INFO 7080 --- [ restartedMain] com.savetweet.tweet.TweetApplication : Starting TweetApplication on DESKTOP-ND86E11 with PID 7080 (C:\Users\iko\Desktop\tweet\target\classes started by iko in C:\Users\iko\Desktop\tweet)
2019-02-10 21:09:03.668 DEBUG 7080 --- [ restartedMain] com.savetweet.tweet.TweetApplication : Running with Spring Boot v2.1.2.RELEASE, Spring v5.1.4.RELEASE
2019-02-10 21:09:03.669 INFO 7080 --- [ restartedMain] com.savetweet.tweet.TweetApplication : No active profile set, falling back to default profiles: default
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.vmplugin.v7.Java7$1 (file:/C:/Users/iko/.m2/repository/org/codehaus/groovy/groovy/2.5.5/groovy-2.5.5.jar) to constructor java.lang.invoke.MethodHandles$Lookup(java.lang.Class,int)
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.vmplugin.v7.Java7$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2019-02-10 21:09:04.037 INFO 7080 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
2019-02-10 21:09:04.037 INFO 7080 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
2019-02-10 21:09:05.035 INFO 7080 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-02-10 21:09:05.125 INFO 7080 --- [ restartedMain] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 79ms. Found 1 repository interfaces.
2019-02-10 21:09:05.680 INFO 7080 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$5fbd0686] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2019-02-10 21:09:06.245 INFO 7080 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
2019-02-10 21:09:06.292 INFO 7080 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
2019-02-10 21:09:06.292 INFO 7080 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.14]
2019-02-10 21:09:06.303 INFO 7080 --- [ restartedMain] o.a.catalina.core.AprLifecycleListener : The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [C:\Program Files\Java\jdk-9.0.4\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\ProgramData\DockerDesktop\version-bin;C:\Program Files\Docker\Docker\Resources\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\GtkSharp\2.12\bin;C:\Program Files\nodejs\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\dotnet\;C:\Program Files\Java\jdk-9.0.4\bin;C:\Program Files\Java\jdk-9.0.4\bin;C:\Program Files\apache-maven-3.5.2;C:\Program Files\apache-maven-3.5.2\bin;C:\Program Files (x86)\Microsoft Emulator Manager\1.0\;C:\Program Files\PuTTY\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\Tools\Binn\;C:\Program Files\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio\;C:\Users\iko\Desktop\TensorFlow\bazel;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\iko\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Users\iko\AppData\Roaming\npm;C:\Users\iko\AppData\Local\Programs\Fiddler;C:\Users\iko\Desktop\TensorFlow\bazel;C:\Users\iko\Desktop\TensorFlow\bazel.exe;;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;.]
2019-02-10 21:09:06.487 INFO 7080 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2019-02-10 21:09:06.487 DEBUG 7080 --- [ restartedMain] o.s.web.context.ContextLoader : Published root WebApplicationContext as ServletContext attribute with name [org.springframework.web.context.WebApplicationContext.ROOT]
2019-02-10 21:09:06.487 INFO 7080 --- [ restartedMain] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 2450 ms
Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
2019-02-10 21:09:06.682 INFO 7080 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting...
2019-02-10 21:09:06.686 WARN 7080 --- [ restartedMain] com.zaxxer.hikari.util.DriverDataSource : Registered driver with driverClassName=com.mysql.jdbc.Driver was not found, trying direct instantiation.
2019-02-10 21:09:06.883 INFO 7080 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed.
2019-02-10 21:09:08.537 ERROR 7080 --- [ restartedMain] o.h.engine.jdbc.spi.SqlExceptionHelper : null
2019-02-10 21:09:08.547 WARN 7080 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
2019-02-10 21:09:08.549 INFO 7080 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2019-02-10 21:09:08.562 INFO 7080 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2019-02-10 21:09:08.565 INFO 7080 --- [ restartedMain] o.apache.catalina.core.StandardService : Stopping service [Tomcat]
2019-02-10 21:09:08.578 INFO 7080 --- [ restartedMain] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-02-10 21:09:08.593 ERROR 7080 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1745) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:576) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:498) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:320) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:318) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:853) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:546) ~[spring-context-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.2.RELEASE.jar:2.1.2.RELEASE]
at com.savetweet.tweet.TweetApplication.main(TweetApplication.java:35) [classes/:na]
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:564) ~[na:na]
at org.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) [spring-boot-devtools-2.1.2.RELEASE.jar:2.1.2.RELEASE]
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:402) ~[spring-orm-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:377) ~[spring-orm-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341) ~[spring-orm-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1804) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1741) ~[spring-beans-5.1.4.RELEASE.jar:5.1.4.RELEASE]
... 21 common frames omitted
Caused by: org.hibernate.exception.GenericJDBCException: Unable to open JDBC Connection for DDL execution
at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:47) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:113) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:99) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:69) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcConnection(ImprovedExtractionContextImpl.java:60) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.internal.exec.ImprovedExtractionContextImpl.getJdbcDatabaseMetaData(ImprovedExtractionContextImpl.java:67) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.extract.internal.InformationExtractorJdbcDatabaseMetaDataImpl.getTables(InformationExtractorJdbcDatabaseMetaDataImpl.java:329) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.extract.internal.DatabaseInformationImpl.getTablesInformation(DatabaseInformationImpl.java:120) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.internal.GroupedSchemaMigratorImpl.performTablesMigration(GroupedSchemaMigratorImpl.java:65) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.performMigration(AbstractSchemaMigrator.java:207) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.internal.AbstractSchemaMigrator.doMigration(AbstractSchemaMigrator.java:114) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.performDatabaseAction(SchemaManagementToolCoordinator.java:183) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator.process(SchemaManagementToolCoordinator.java:72) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:310) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:467) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:939) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:57) ~[spring-orm-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365) ~[spring-orm-5.1.4.RELEASE.jar:5.1.4.RELEASE]
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:390) ~[spring-orm-5.1.4.RELEASE.jar:5.1.4.RELEASE]
... 25 common frames omitted
Caused by: java.sql.SQLFeatureNotSupportedException: null
at com.zaxxer.hikari.HikariDataSource.getConnection(HikariDataSource.java:135) ~[HikariCP-3.2.0.jar:na]
at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.getConnection(DatasourceConnectionProviderImpl.java:122) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess.obtainConnection(JdbcEnvironmentInitiator.java:180) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
at org.hibernate.resource.transaction.backend.jdbc.internal.DdlTransactionIsolatorNonJtaImpl.getIsolatedConnection(DdlTransactionIsolatorNonJtaImpl.java:43) ~[hibernate-core-5.3.7.Final.jar:5.3.7.Final]
... 40 common frames omitted