Riak & Java - com.fasterxml.jackson.core.JsonParseException: 意外字符 ('<' (code 60))
Posted
技术标签:
【中文标题】Riak & Java - com.fasterxml.jackson.core.JsonParseException: 意外字符 (\'<\' (code 60))【英文标题】:Riak & Java - com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60))Riak & Java - com.fasterxml.jackson.core.JsonParseException: 意外字符 ('<' (code 60)) 【发布时间】:2013-07-26 09:19:06 【问题描述】:我正在尝试执行此代码(我在主/从集群上部署了 Riak)。我正在使用 Riak 的 JAVA API:
import com.basho.riak.client.IRiakClient;
import com.basho.riak.client.IRiakObject;
import com.basho.riak.client.RiakException;
import com.basho.riak.client.RiakFactory;
import com.basho.riak.client.bucket.Bucket;
public class RiakTest
public static void main(String[] args) throws RiakException
String myData = "This is my data";
IRiakClient riakClient = RiakFactory.httpClient("http://riak.master.ip.adress:8098");
Bucket myBucket = riakClient.fetchBucket("TestBucket").execute();
myBucket.store("TestKey", myData).execute();
riakClient.shutdown();
我提出了这个错误:
Exception in thread "main" com.basho.riak.client.RiakRetryFailedException: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@1394894; line: 1, column: 2]
at com.basho.riak.client.cap.DefaultRetrier.attempt(DefaultRetrier.java:79)
at com.basho.riak.client.cap.DefaultRetrier.attempt(DefaultRetrier.java:81)
at com.basho.riak.client.cap.DefaultRetrier.attempt(DefaultRetrier.java:81)
at com.basho.riak.client.cap.DefaultRetrier.attempt(DefaultRetrier.java:81)
at com.basho.riak.client.cap.DefaultRetrier.attempt(DefaultRetrier.java:53)
at com.basho.riak.client.bucket.FetchBucket.execute(FetchBucket.java:72)
at RiakTest.main(RiakTest.java:16)
Caused by: com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
at [Source: java.io.StringReader@1394894; line: 1, column: 2]
at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1369)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:599)
at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:520)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser._handleUnexpectedValue(ReaderBasedJsonParser.java:1379)
at com.fasterxml.jackson.core.json.ReaderBasedJsonParser.nextToken(ReaderBasedJsonParser.java:669)
at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:2926)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2873)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:2034)
at com.basho.riak.client.raw.http.ConversionUtil.convert(ConversionUtil.java:362)
at com.basho.riak.client.raw.http.HTTPClientAdapter.fetchBucket(HTTPClientAdapter.java:329)
at com.basho.riak.client.bucket.FetchBucket$1.call(FetchBucket.java:74)
at com.basho.riak.client.bucket.FetchBucket$1.call(FetchBucket.java:72)
at com.basho.riak.client.cap.DefaultRetrier.attempt(DefaultRetrier.java:72)
... 6 more
你知道问题出在哪里吗?
谢谢
【问题讨论】:
【参考方案1】:因为这不是一个有效的 Riak URL。
应该是http://riak.master.ip.adress:8098/riak
【讨论】:
以上是关于Riak & Java - com.fasterxml.jackson.core.JsonParseException: 意外字符 ('<' (code 60))的主要内容,如果未能解决你的问题,请参考以下文章
为啥大公司使用 Mnesia 而不是使用 Riak 或 CouchDB [关闭]