Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/343.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java NotSslRecordException:不是SSL/TLS记录_Java_Spring Data_Netty_Spring Data Redis_Amazon Elasticache - Fatal编程技术网

Java NotSslRecordException:不是SSL/TLS记录

Java NotSslRecordException:不是SSL/TLS记录,java,spring-data,netty,spring-data-redis,amazon-elasticache,Java,Spring Data,Netty,Spring Data Redis,Amazon Elasticache,我正在使用redisspring数据(1.8.9.RELEASE)和莴苣(4.5.0.Final)作为底层Redis驱动程序。它使用的是netty版本4.1.29 我们正在使用Redis ElastiCache,并启用了传输加密和静止加密 我在犯错误。我看到了一篇与netty的NotSslRecordException相关的帖子,其中http和https不匹配。但我们使用elasticache实现tcp连接 Caused by: com.lambdaworks.redis.RedisExcept

我正在使用redisspring数据(
1.8.9.RELEASE
)和莴苣(
4.5.0.Final
)作为底层Redis驱动程序。它使用的是netty版本
4.1.29

我们正在使用Redis ElastiCache,并启用了传输加密和静止加密

我在犯错误。我看到了一篇与netty的
NotSslRecordException
相关的帖子,其中http和https不匹配。但我们使用elasticache实现tcp连接

Caused by: com.lambdaworks.redis.RedisException: com.lambdaworks.redis.RedisConnectionException: Unable to connect to xxx-redis-xxx-0002-002.-redis-xxx.usw2.cache.amazonaws.com:6379
    at com.lambdaworks.redis.LettuceFutures.await(LettuceFutures.java:130)
    at com.lambdaworks.redis.LettuceFutures.awaitOrCancel(LettuceFutures.java:96)
    at com.lambdaworks.redis.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java:117)
    at com.lambdaworks.redis.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80)
    at com.sun.proxy.$Proxy344.hgetall(Unknown Source)
    at org.springframework.data.redis.connection.lettuce.LettuceConnection.hGetAll(LettuceConnection.java:2887)
    ... 53 more
Caused by: com.lambdaworks.redis.RedisConnectionException: Unable to connect to qbo-pprd-redis-rpg-0002-002.qbo-pprd-redis-rpg.jtrqdt.usw2.cache.amazonaws.com:6379
    at com.lambdaworks.redis.RedisConnectionException.create(RedisConnectionException.java:56)
    at com.lambdaworks.redis.cluster.PooledClusterConnectionProvider.lambda$getConnectionAsync$7(PooledClusterConnectionProvider.java:344)
    at java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:822)
    at java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:797)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
    at com.lambdaworks.redis.AbstractRedisClient.lambda$null$0(AbstractRedisClient.java:331)
    at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:760)
    at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:736)
    at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:474)
    at java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:1977)
    at com.lambdaworks.redis.SslConnectionBuilder$SslChannelInitializer$2.userEventTriggered(SslConnectionBuilder.java:212)
    at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:329)
    at io.netty.channel.AbstractChannelHandlerContext.invokeUserEventTriggered(AbstractChannelHandlerContext.java:315)
    at io.netty.channel.AbstractChannelHandlerContext.fireUserEventTriggered(AbstractChannelHandlerContext.java:307)
    at io.netty.handler.ssl.SslUtils.handleHandshakeFailure(SslUtils.java:319)
    at io.netty.handler.ssl.SslHandler.setHandshakeFailure(SslHandler.java:1573)
    at io.netty.handler.ssl.SslHandler.setHandshakeFailure(SslHandler.java:1542)
    at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1183)
    at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1243)
    at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
    at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
    at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
    at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:628)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:563)
    at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:480)
    at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:442)
    at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
    at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
    ... 1 more
Caused by: java.util.concurrent.CompletionException: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 17000000242d455252206d6178206e756d626572206f6620636c69656e747320726561636865640d0a15000000020100
    at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:292)
    at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:308)
    at java.util.concurrent.CompletableFuture.uniApply(CompletableFuture.java:593)
    at java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:577)
    ... 38 more
Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 17000000242d455252206d6178206e756d626572206f6620636c69656e747320726561636865640d0a15000000020100    

从线程堆栈中可以看出,您正在将SpringDataRedis与莴苣库结合使用

在创建LettuceClientConfiguration时,您需要通过设置此选项useSSL()来告诉客户端使用SSL;


我希望这是有帮助的

由于我不熟悉Redis Spring数据和莴苣,因此我在这方面没有太多帮助,但我可以告诉您,底层的netty SslHandler期望ssl握手,但收到的不是ssl握手(客户端/服务器可能没有尝试通过ssl建立连接)。我已经将客户端设置为使用SSL-lettuceConnectionFactory.setUseSsl(true)。这个问题是间歇性的。
$ printf '17000000242d455252206d6178206e756d626572206f6620636c69656e747320726561636865640d0a15000000020100' | xxd -r -p | xxd
00000000: 1700 0000 242d 4552 5220 6d61 7820 6e75  ....$-ERR max nu
00000010: 6d62 6572 206f 6620 636c 6965 6e74 7320  mber of clients 
00000020: 7265 6163 6865 640d 0a15 0000 0002 0100  reached.........