NutzCN Logo
问答 调用java jredis mset方法异常
发布于 3294天前 作者 qq_9a50e667 2671 次浏览 复制 上一个帖子 下一个帖子
标签: jredis

运行代码片段:
/**
* Using the synchronous interface
*/
public static void usingSyncClient () {
ConnectionSpec spec = DefaultConnectionSpec.newSpec("192.168.68.110",6666,0,null)
.setCredentials("mypass".getBytes())
.setDatabase(10);

    JRedis jredis = new JRedisClient(spec);
    System.out.println ("\nusing the SyncClient: \n\n");
    try {
       Strings<String> kvSet = BulkSetMapping.newStringKVSet();
       kvSet
       .add("foo", "woof")
       .add("bar", "meow")
       .add("paz", "thesalt");
    // mappings.add("ewe", "dwe");
          jredis.mset(kvSet);
    } catch (RedisException e) {
       // TODO Auto-generated catch block
       e.printStackTrace();
    }  
    //useMSet (jredis);
//  useMSetNX (jredis);
    jredis.quit();
}

** 异常信息:
01447661803808 Mon Nov 16 16:16:43 CST 2015 JRedis[tid:10] <信息>: WARNING: heartbeat is disabled.
01447661803831 Mon Nov 16 16:16:43 CST 2015 JRedis[tid:10] <严重>: Error response for MSET => ERR Protocol error: expected '$', got '*'
Exception on [MSET] => ERR Protocol error: expected '$', got '*'
at org.jredis.ri.alphazero.connection.SyncConnection.serviceRequest(SyncConnection.java:156)
at org.jredis.ri.alphazero.JRedisClient.serviceRequest(JRedisClient.java:151)
at org.jredis.ri.alphazero.JRedisSupport.mset(JRedisSupport.java:1140)
at org.jredis.ri.alphazero.JRedisSupport.mset(JRedisSupport.java:1156)
at org.jredis.examples.commands.UsingBulkCommands.usingSyncClient(UsingBulkCommands.java:119)
at org.jredis.examples.commands.UsingBulkCommands.main(UsingBulkCommands.java:48)

添加回复
请先登陆
回到顶部