1

我正在尝试执行此代码(我在主/从集群上部署了 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

你知道问题可能来自哪里吗?

谢谢

4

1 回答 1

3

因为那不是一个有效的 Riak URL。

它应该是http://riak.master.ip.adress:8098/riak

于 2013-07-26T12:51:37.003 回答