spring boot 项目部署在Docker中调用redis出现的奇怪问题

本文介绍了解决在Docker环境下部署应用时出现的WhitelabelErrorPage问题的方法。该问题源于未能正确配置Redis连接,导致应用内部无法初始化与Redis相关的组件。通过在容器内安装并启动Redis服务,成功解决了此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Whitelabel Error Page

This application has no explicit mapping for /error, so you are seeing this as a fallback.

Wed Dec 14 09:43:13 UTC 2016
There was an unexpected error (type=Internal Server Error, status=500).

Error creating bean with name 'enableRedisKeyspaceNotificationsInitializer' defined in class path resource [org/springframework/session/data/redis/config/annotation/web/http/RedisHttpSessionConfiguration.class]: Invocation of init method failed; nested exception is org.springframework.data.redis.RedisConnectionFailureException: Cannot get Jedis connection; nested exception is redis.clients.jedis.exceptions.JedisConnectio

 

以上是在Docker环境部署后页面上展示的错误,不用Docker直接用java -jar jar包名称的形式启动完全正常

解决方法

1 进入Docker容器

2 安装redis(我用的是ubuntu)

apt-get update
apt-get install redis-server
#启动redis
redis-server /etc/redis/redis.conf

3然后就正常啦

转载于:https://www.cnblogs.com/westfruit/p/6180351.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值