- Problem description
Redis was originally used, but now Pika is used. Springboot version 2.1.8 is used. ClientName is configured inside. There is no problem when starting, but the following exception information will be reported when using:
org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool] with root cause
redis.clients.jedis.exceptions.JedisDataException: ERR Syntax error, try CLIENT (LIST [order by [addr|idle]| KILL ip:port)
@Bean
public RedisConnectionFactory connectionFactory(RedisProperties redisProperties) {
JedisClientConfiguration clientConfig = JedisClientConfiguration.builder()
.clientName("zcx")
.usePooling().poolConfig(getGenericObjectJedisPoolConfig(redisProperties)).and().readTimeout(redisProperties.getTimeout())
.build();
RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(redisProperties.getHost());
configuration.setPort(redisProperties.getPort());
configuration.setPassword(RedisPassword.of(redisProperties.getPassword()));
return new JedisConnectionFactory(configuration, clientConfig);
}
2. Solution
After searching, it is caused by the ClientName field. Just remove the ClientName configuration. The problem is found as follows:
Call creation connection in class GenericObjectPool
private PooledObject<T> create() throws Exception {
...
final PooledObject<T> p;
try {
p = factory.makeObject();
} catch (final Throwable e) {
createCount.decrementAndGet();
throw e;
} finally {
synchronized (makeObjectCountLock) {
makeObjectCount--;
makeObjectCountLock.notifyAll();
}
}
}
The client setname “zcx” command is called in the JedisFactory class, and an exception is thrown.
@Override
public PooledObject<Jedis> makeObject() throws Exception {
final HostAndPort hostAndPort = this.hostAndPort.get();
final Jedis jedis = new Jedis(hostAndPort.getHost(), hostAndPort.getPort(), connectionTimeout,
soTimeout, ssl, sslSocketFactory, sslParameters, hostnameVerifier);
try {
jedis.connect();
if (password != null) {
jedis.auth(password);
}
if (database != 0) {
jedis.select(database);
}
if (clientName != null) {
jedis.clientSetname(clientName);
}
} catch (JedisException je) {
jedis.close();
throw je;
}
In the final analysis, pika does not support the client setname command, so when creating a connection, it cannot obtain the connection and report that the command is not supported
Read More:
- Kill Tomcat process in windows and Linux environment (solve the problem of other ports being occupied)
- [Solved] rabbitMQ: factory.newConnection() Error: com.rabbitmq.client.ShutdownSignalException
- [Solved] matlab Error: Error in port widths or dimensions. ‘Output Port 1‘ of ‘sl_arm_ibvs/camera‘
- [Solved] Error: failed to create deliver client: orderer client failed to connect to orderer.example.com:7050
- Kubernetes Error: Error in configuration: unable to read client-cert* unable to read client-key*
- [Solved] Fabric Start Network Error: Error: error getting endorser client for channel: endorser client failed to connect to
- [Solved] CXF Call webservice Client Error: 2 counts of InaccessibleWSDLException
- Nacos Error: server is DOWN now, please try again later! [How to Solve]
- HLS ERROR: [IMPL 213-28] Failed to generate IP. [How to Solve]
- When Wireshark grabs packets, IP check sum error is displayed
- openwrt ipv6 nat6 ip6tables [How to Solve]
- [Solved] harbor Error: because it doesn‘t contain any IP SANs
- ERROR: [IMPL 213-28] Failed to generate IP.
- [Solved] failed to set bridge addr: “cni0“ already has an IP address different from xxxx
- [Solved] Feign Error: -‘oauth-client.FeignClientSpecification‘ could not be registered
- How to Solve Client-go Mod Error
- Mysql5.7.18.1 Error 1054 (42S22): Unknown Column’password’ In’field List’ When Changing User Password
- [Solved] Error: Could not open client transport with JDBC Uri
- [Solved] IP Core Map Compile Error: Buffers of the same direction cannot beplaced in series.
- [Solved] Redis Execute redis-cli shutdown Error: (error) ERR Errors trying to SHUTDOWN. Check logs.