Connection Timeout for Spring Redis using Redis Cloud - spring

I am trying to connect Redis in my Spring application.
I have created a Redis Database in Redis Cloudredis-10228.c15.us-east-1-2.ec2.cloud.redislabs.com:10228.
I have configured the following in my application.properties
spring.redis.host=redis-10228.c15.us-east-1-2.ec2.cloud.redislabs.com:10228
spring.redis.password=<password-from-redis-cloud>
I am still getting Redis Connection failure event after providing password.
reactor.core.Exceptions$ErrorCallbackNotImplemented: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to redis-10228.c15.us-east-1-2.ec2.cloud.redislabs.com:10228
Caused by: org.springframework.data.redis.RedisConnectionFailureException: Unable to connect to Redis; nested exception is io.lettuce.core.RedisConnectionException: Unable to connect to redis-10228.c15.us-east-1-2.ec2.cloud.redislabs.com:10228
Any misconfiguration done from my part?

You need to specify the redis port in a different property:
spring.redis.host=redis-10228.c15.us-east-1-2.ec2.cloud.redislabs.com
spring.redis.port=10228
See this for more details.

Related

In Spring boot running in ECS getting connection reset - using restTemplate

I deployed the spring boot in AWS ECS
When making api using restetemplate ,it is giving the below error
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "THE URL": Connection reset; nested exception is java.net.SocketException: Connection reset
But this error is occurring intermediate only , how to resolve this issue

My application say, too many connections but the db connection is not full

My application say,
Error querying database. Cause: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
But DB connection is not full.
I use spring and mybatis and mariaDB. what is the problem?
enter image description here

Can't turn of auto create function in embedded ActiveMQ

I would like to use ActiveMQ in my Spring Boot application. During debugging I have found out following error:
org.apache.activemq.broker.BrokerService : Failed to start Apache ActiveMQ (localhost, null)javax.management.InstanceAlreadyExistsException: org.apache.activemq:type=Broker,brokerName=localhost`
Seems like broker is created upon creation of the first connection, according to ActiveMQ's documentation. Is is possible to turn off auto-creation by setting the create property on the VM Transport to false, e.g.:
ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("vm://localhost?create=false");
When I tried this solution I got following error:
DefaultJmsMessageListenerContainer : Could not refresh JMS Connection for destination 'test' - retrying using FixedBackOff{interval=5000, currentAttempts=364, maxAttempts=unlimited}. Cause: Could not create Transport. Reason: java.io.IOException: Broker named 'localhost' does not exist.
Now I think the broker is not creating at all or this process is pending. Did anyone have a similar issue? If so how did you resolve it?
ActiveMQ's vm transport optionally creates a broker, or connects to a running broker.
Sounds like you are missing a step in your application boot-up plan. Either you need:
A component to startup the broker
Designate one of the connection factories to start the broker using the vm transport:
Designated broker startup connection factory:
vm://localhost?create=true
All other connection factories:
vm://localhost?create=false

Spring RestTemplate call fails intermittently with 'SocketException: Connection reset'

The following exception i am getting when our application is consuming the Rest endpoint using spring boot RestTemplate.
org.springframework.web.client.ResourceAccessException: I/O error on POST request for "https://xxxxxxxxxx:123456/xxxxx/xxxxx/xxxxxx/xxxx":
Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset; nested exception is javax.net.ssl.SSLException:
Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Connection reset
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:741)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:684)
at org.springframework.web.client.RestTemplate.postForEntity(RestTemplate.java:466)
This issue we are getting intermittently. some time more than 2 to 3 times.
I couldn't find any information specific to this issue ?
Does any one faced same issue and how its resolved?
Do the CURL on the endpoint you are trying to access using RESTTemplate and see if your machine has access to that URL?
If Yes-->Let me know and still getting an error, Let me know I will update the answer:)
If No-->that the problem I had the same issue for facebook API.

Unable to acquire JDBC Connection in SpringBoot app

I have a Microservices‑Based Application, each Microservice is a SpringBoot 2.0.3.RELEASE app., but after my 4rth Microservices launched I have this error:
Unable to acquire JDBC Connection; nested exception is org.hibernate.exception.JDBCConnectionException: Unable to acquire JDBC Connection
..
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Too many connections
I would like to know how to reduce the maximumPoolSize or if there is a way to know maximumPoolSize because I have't seen anything related when the app starts
You can set the maximum pool size of the JDBC connections in your application.properties file like:
spring.datasource.hikari.maximum-pool-size=5

Resources