redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 192.168.xxx
来源:互联网 发布:当淘宝模特工资多少 编辑:程序博客网 时间:2024/06/06 10:47
Java代码连接远程Redis服务器,报如下错误
Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 192.168.43.108Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 192.168.43.108 at redis.clients.jedis.Connection.connect(Connection.java:134) at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:69) at redis.clients.jedis.Connection.sendCommand(Connection.java:79) at redis.clients.jedis.Connection.sendCommand(Connection.java:75) at redis.clients.jedis.Jedis.get(Jedis.java:66) at com.adtec.redisdemo.RedisDemo.main(RedisDemo.java:17)Caused by: java.net.UnknownHostException: 192.168.43.108 at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at redis.clients.jedis.Connection.connect(Connection.java:129) ... 5 more
源码:
public static void main(String[] args) { Jedis jedis = new Jedis(" 192.168.43.108",6379); String name = jedis.get("testMessage"); System.out.println(name); }
然后就排错排了一下午!!!
最后发现是ip前边多了个空格!!
万恶的空格!!!!
Linux端查看ip:
ifconfig
或
ip add
本地测试是否能连接远程服务器某端口:
打开cmd
telnet 192.168.43.108 6379
如果不能用telnet的,点击这里
如果连不上,那就是远程服务端开了防火墙什么的,另寻它策
阅读全文
1 0
- redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 192.168.xxx
- redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketException
- redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refu
- redis.clients.jedis.exceptions.JedisConnectionException
- centOS下 jedis连接redis失败 redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectExce
- Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: java.net.SocketT
- edis.clients.jedis.exceptions.JedisConnectionException: java.Net.SocketTimeoutException: Read timed
- redis.clients.jedis.exceptions.JedisConnectionException: no reachable node in cluster
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resourc
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resourc
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resourc
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- Exception in thread "main" redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: J
- ed exception is redis.clients.jedis.exceptions.JedisConnectionException: Unknown reply: O 异常处理记录
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool
- 2017 ACM/ICPC Asia Regional Shenyang Online//cable cable cable题解
- c++11 chrono时间处理函数
- Android 给GridView添加分割线
- dl dt dd和table tr td
- 使用类和对象
- redis.clients.jedis.exceptions.JedisConnectionException: java.net.UnknownHostException: 192.168.xxx
- 计算机网络笔记整理(五):运输层
- mysql 自定义方法url_decode
- synchronized与Lock
- 【PAT】【Advanced Level】1115. Counting Nodes in a BST (30)
- Python学习之深浅拷贝
- 系统重装配置一切windows常用开发组件
- Windows下Mysql增量备份的方法
- 不要创建String对象