2017-12-04 4 views
0

LinuxのUbuntuのRiakサーバーにJavaのEclipseを接続しようとしています。 ガイドをフォローアップしても、まだ動作しません。 Riakにクライアント-2.0.2 - - EclipseのOxygen.1aリリース(4.7.1a) - Ubuntuの16.04.3 - "1.8.0_151"Java Riakの接続に関する問題

を持っているが、SLF4Jと前にいくつかの問題を抱えていたOpenJDKのバージョンを :使用 だから私はそれを解決するために外部の瓶: slf4j - jdk14-1.7.25 - ソースを追加しました。

マイコード:

import com.basho.riak.client.api.RiakClient; 
import com.basho.riak.client.api.commands.kv.FetchValue; 
import com.basho.riak.client.api.commands.kv.StoreValue; 
import com.basho.riak.client.core.query.Location; 
import com.basho.riak.client.core.query.Namespace; 


import java.net.UnknownHostException; 
import java.util.concurrent.ExecutionException; 

public class ProdukteEinlesen { 
    public static void main(String [] args) throws UnknownHostException, ExecutionException, InterruptedException { 

     RiakClient client = RiakClient.newClient(8098, "127.0.0.1"); 
     Location location = new Location(new Namespace("TestBucket"),"TestKey"); 

     FetchValue fv = new FetchValue.Builder(location).build(); 
     FetchValue.Response response = client.execute(fv); 

     // Fetch object as String 
     String value = response.getValue(String.class); 
     System.out.println(value); 

     client.shutdown(); 
    } 
} 

は今、私はこれを取得しています:

Dez 04, 2017 5:58:23 PM com.basho.riak.client.core.RiakNode start 
INFORMATION: RiakNode started; 127.0.0.1:8098 
Dez 04, 2017 5:58:23 PM com.basho.riak.client.core.RiakCluster start 
INFORMATION: RiakCluster is starting. 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-2083854054 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:674162571 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:1161062152 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1411904647 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1369356068 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:957736106 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1598195494 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1723639977 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$2 operationComplete 
SCHWERWIEGEND: inAvailable channel closed; id:-1232050671 127.0.0.1:8098 
Dez 04, 2017 6:03:20 PM com.basho.riak.client.core.RiakNode$3 operationComplete 
SCHWERWIEGEND: Channel closed while operation in progress; id:-459317961 127.0.0.1:8098 
Dez 04, 2017 6:08:17 PM com.basho.riak.client.core.RiakNode healthCheckFailed 
SCHWERWIEGEND: RiakNode failed healthcheck operation; health checking; 127.0.0.1:8098 java.io.IOException: Channel closed while performing health check op. 
Dez 04, 2017 6:08:17 PM com.basho.riak.client.core.DefaultNodeManager nodeStateChanged 
INFORMATION: NodeManager moved node to unhealthy list; 127.0.0.1:8098 
Dez 04, 2017 6:08:17 PM com.basho.riak.client.core.RiakNode$3 operationComplete 
SCHWERWIEGEND: Channel closed while operation in progress; id:-1254319488 127.0.0.1:8098 
Exception in thread "main" java.util.concurrent.ExecutionException: com.basho.riak.client.core.NoNodesAvailableException 
    at com.basho.riak.client.core.FutureOperation.get(FutureOperation.java:260) 
    at com.basho.riak.client.api.commands.CoreFutureAdapter.get(CoreFutureAdapter.java:52) 
    at com.basho.riak.client.api.RiakCommand.execute(RiakCommand.java:89) 
    at com.basho.riak.client.api.RiakClient.execute(RiakClient.java:293) 
    at ProdukteEinlesen.main(ProdukteEinlesen.java:18) 
Caused by: com.basho.riak.client.core.NoNodesAvailableException 
    at com.basho.riak.client.core.RiakCluster.retryOperation(RiakCluster.java:468) 
    at com.basho.riak.client.core.RiakCluster.access$1000(RiakCluster.java:47) 
    at com.basho.riak.client.core.RiakCluster$RetryTask.run(RiakCluster.java:553) 
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
    at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) 
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
    at java.lang.Thread.run(Thread.java:748) 

私RiakにDBは、コマンド経由ですでにそれを味わっ正常に動作しています。

答えて

1

Riak接続に不正なポート番号が使用されているようです。プロトコルバッファAPIの正しいポートは8087です(デフォルトを変更していないものとします)。ポート8098はHTTP用です。cURLまたは別のHTTPクライアントを使用してサーバーをテストしている必要があります。次のようにJavaコードは次のようになります。

RiakClient client = RiakClient.newClient(8087, "127.0.0.1"); 
関連する問題