创建JedisPool连接池对象时,抛出的Exception:hostname can't be null
来源:互联网 发布:网络贷款 编辑:程序博客网 时间:2024/06/05 00:25
java.lang.IllegalArgumentException: hostname can't be null
报的错误是这个,多次检查,Debug之后无果,最后是在配置上面找到了突破口
分析:
1、JedisPool类中的方法可能有引起歧义的参数存在,先看下我的配置情况,
这是出问题的配置
<!-- 创建连接池对象 --><bean id="jedisPool" class="redis.clients.jedis.JedisPool"><constructor-arg index="0" ref="jedisConfig"></constructor-arg><constructor-arg index="1" value="127.0.0.1"></constructor-arg><constructor-arg index="2" value="6379"></constructor-arg></bean>
2、在JedisPool中找到了参数不同类型的方法:
我这里需要设置的是一个String类型的参数,但是可能由于没有指定参数类型就导致了编译器运行到这里随机分配到了URl参数的类型方法(不知道这里的分配策略是怎样的,因为有成功的情况)
3、解决方案
在配置代码加上了指定数据类型Type的属性设置
<!-- 创建连接池对象 --><bean id="jedisPool" class="redis.clients.jedis.JedisPool"><constructor-arg index="0" ref="jedisConfig"></constructor-arg><constructor-arg index="1" type="java.lang.String" value="127.0.0.1"></constructor-arg><constructor-arg index="2" type="int" value="6379"></constructor-arg></bean>
阅读全文
0 0
- 创建JedisPool连接池对象时,抛出的Exception:hostname can't be null
- java.lang.IllegalArgumentException: hostname can't be null这个异常的解决办法分析
- Navicat连接Mysql报1042- Can't get hostname for your address错误的解决办法
- gcc mac throw exception can't be caught.
- 集智平台报表启动报错InputStream can’t be null的解决办法
- ElasticSearch 创建Child type 报错“The _parent field's type option can't be changed: [null]->[member]”
- scp can't be established. 的问题
- 关于PDFBox读PDF时抛出Can't Close Pdf 的问题解决
- ssh连接时提示“The authenticity of host xx can’t be established”
- ssh连接时提示“The authenticity of host xx can’t be ...
- ssh连接时去掉“The authenticity of host xx can’t be established”解决方法
- SSH连接时提示“THE AUTHENTICITY OF HOST XX CAN’T BE ESTABLISHED”
- SSH连接时提示“THE AUTHENTICITY OF HOST XX CAN’T BE ESTABLISHED
- ssh连接The authenticity of host can't be established
- ssh连接The authenticity of host can't be established
- Mysql 访问,提示无法连接Can't get hostname for your address Error 1042
- 通过远程连接Mysql数据库,提示“can't get hostname for your address”
- MySQL连接远程数据库报错 1042Can't get hostname for your address
- Android多进程通信
- AtCoder ARC088C Multiple Gift
- Java8之Stream
- 使用 vue 构建 video 组件
- python-快速使用urllib爬取网页(2-Headers属性)
- 创建JedisPool连接池对象时,抛出的Exception:hostname can't be null
- Java8之方法引用
- 输出一个三角形
- 模拟退火算法——自我总结
- 数据结构实验之排序六:希尔排序
- 图像处理入门教程
- 226. Invert Binary Tree
- 关于数据库触发器的个人理解/注解
- 记录下找BUG的方法