Error while connecting to Cassandra using Java Driver for Apache Cassandra 1.0 from com.example.cassandra

前端 未结 11 572
感动是毒
感动是毒 2020-12-29 21:38

While connecting to Cassandra client using java driver for Cannsandra by DataStax, it is throwing following error..

Exception in thread \"main\" com.datastax

相关标签:
11条回答
  • 2020-12-29 22:05

    I had this issue and it was sorted by setting the ReadTimeout in SocketOptions:

    Cluster cluster = Cluster.builder().addContactPoint("localhost").build();
    cluster.getConfiguration().getSocketOptions().setReadTimeoutMillis(HIGHER_TIMEOUT);
    
    0 讨论(0)
  • 2020-12-29 22:06

    In my case this was a port issue, which I forgot to update

    Old RPC port is 9160
    New binary port is 9042

    0 讨论(0)
  • 2020-12-29 22:09

    I too encountered this problem, and it was caused by a simple error in the statement that was being submitted.

    session.prepare(null);
    

    Obviously, the error message is misleading.

    0 讨论(0)
  • 2020-12-29 22:14

    Check below points:

    i) check server ip

    ii) check listening port

    iii) data-stack client dependency must match the server version.

    About the yaml file, latest versions has below properties enabled:

        start_native_transport: true
        native_transport_port: 9042
    
    0 讨论(0)
  • 2020-12-29 22:15

    Assuming you have default configurations in place, check the driver version compatibility. Not all driver versions are compatible with all versions of Cassandra, though they claim backward compatibility. Please see the below link.

    http://docs.datastax.com/en/developer/java-driver/3.1/manual/native_protocol/

    I ran into a similar issue & changing the driver version solved my problem.

    Note: Hopefully, you are using Maven (or something similar) to resolve dependencies. Otherwise, you may have to download a lot of dependencies for higher versions of the driver.

    0 讨论(0)
  • 2020-12-29 22:16

    Edit

    /etc/cassandra/cassandra.yaml 
    

    and change

    rpc_address to 0.0.0.0,broadcast_rpc_address and listen_address to ip address of the cluster.

    0 讨论(0)
提交回复
热议问题