/127.0.0.1连接上的错误(com.datastax.driver.core.TransportException:[/127.0.0.1]触发了意外的异常),没有其他主机可以尝试 [英] error on /127.0.0.1 connection (com.datastax.driver.core.TransportException: [/127.0.0.1] Unexpected exception triggered), no more host to try

查看:731
本文介绍了/127.0.0.1连接上的错误(com.datastax.driver.core.TransportException:[/127.0.0.1]触发了意外的异常),没有其他主机可以尝试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Windows环境下将Cassandra与Java连接.以下是application/OS/lib版本.

I am trying to connect Cassandra with Java under Windows Environment. Following are application/OS/lib version.

-Windows 7
-Java 7
-Cassandra 2.1.12

代码:

Cluster clst;
Session ses;
clst= Cluster.builder().addContactPoint("127.0.0.1").withPort(9042).build();

Cassandra和nodetool正在运行.以下是nodetool的状态.

Cassandra and nodetool is running. Below is the status of nodetool.

C:\Program Files\DataStax Community\apache-cassandra\bin>nodetool -h localhost status
Starting NodeTool
Datacenter: datacenter1
========================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load       Tokens  Owns    Host ID                               Rack
UN  127.0.0.1  245.99 KB  256     ?       61c6b0e5-2f83-4bc9-9b86-6507e2f06dfc  rack1

Note: Non-system keyspaces don't have the same replication settings, effective ownership information is meaningless
C:\Program Files\DataStax Community\apache-cassandra\bin>

当我尝试将cassandra与localhost/127.0.01连接时,我在stacktrace中遇到错误.

When I am trying to connect cassandra with localhost/127.0.01 I and getting below error in stacktrace.

19:19:05.996 [main] DEBUG c.d.driver.core.ControlConnection - [Control connection] Refreshing node list and token map
19:19:06.465 [main] DEBUG c.d.driver.core.ControlConnection - [Control connection] error on /127.0.0.1 connection (com.datastax.driver.core.TransportException: [/127.0.0.1] Unexpected exception triggered), no more host to try
19:19:06.469 [main] DEBUG com.datastax.driver.core.Cluster - Shutting down
Exception in thread "main" com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: [/127.0.0.1])
    at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:162)
    at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:83)
    at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:516)
    at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:473)
    at com.datastax.driver.core.Cluster.<init>(Cluster.java:65)
    at com.datastax.driver.core.Cluster.buildFrom(Cluster.java:93)
    at com.datastax.driver.core.Cluster$Builder.build(Cluster.java:458)
    at cass.Cass.main(Cass.java:16)
Java Result: 1

我也尝试在另一个站点上找到关于stackoverflow的解决方案,但未能解决我的问题.

Also I have tried to find out the solution on stackoverflow also on another sites but got failed to solve my issue.

有人对此查询有解决方案吗?

Does anybody have the some solution for this query?

推荐答案

我发现了问题,我正在使用大量第三方库从项目中运行代码,而其中一个正在引起错误(我没有知道哪一个).我替换了整个jar文件,问题解决了.转到以下URL,并根据所使用的cassandra版本下载Java驱动程序jar文件. http://docs.datastax.com/zh/developer/driver-matrix/doc/javaDrivers.html#java-drivers

I found the problem, I was running the code from a project using a lot of third parties libraries and one of them is causing the error (I don't know which one yet). I replaced the whole jar files and problem solved. Go to the following url and download the Java driver jar files according to your cassandra version you are using. http://docs.datastax.com/en/developer/driver-matrix/doc/javaDrivers.html#java-drivers

这篇关于/127.0.0.1连接上的错误(com.datastax.driver.core.TransportException:[/127.0.0.1]触发了意外的异常),没有其他主机可以尝试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆