java.lang.ClassCastException: org.apache.cassandra.transport.messages.AuthenticateMessage cannot be cast to org.apache.cassandra.transport.messages.ErrorMessage

DataStax JIRA | Tran Huynh | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    It seems that internal authentication and authorization introduced in 1.2.2 is not yet supported in the Java driver. http://www.datastax.com/docs/1.2/security/native_authentication I tried to make use of the AuthInfoProvider to provide credentials for authenticating with Cassandra 1.2.4 cluster with valid credentials that has read & write permission on the given keyspace as follows: SimpleAuthProvider authProvider = new SimpleAuthProvider(); authProvider.add("user", "password"); Cluster cluster = Cluster.builder() .withAuthInfoProvider(authProvider) .... .build(); But when I execute the code to create this cluster, I get the following exception: java.lang.ClassCastException: org.apache.cassandra.transport.messages.AuthenticateMessage cannot be cast to org.apache.cassandra.transport.messages.ErrorMessage at com.datastax.driver.core.Connection.initializeTransport(Connection.java:157) at com.datastax.driver.core.Connection.<init>(Connection.java:118) at com.datastax.driver.core.Connection.<init>(Connection.java:90) at com.datastax.driver.core.Connection$Factory.open(Connection.java:376) at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:203) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:166) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:83) at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:548) at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:533) 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:484)

    DataStax JIRA | 4 years ago | Tran Huynh
    java.lang.ClassCastException: org.apache.cassandra.transport.messages.AuthenticateMessage cannot be cast to org.apache.cassandra.transport.messages.ErrorMessage
  2. 0

    It seems that internal authentication and authorization introduced in 1.2.2 is not yet supported in the Java driver. http://www.datastax.com/docs/1.2/security/native_authentication I tried to make use of the AuthInfoProvider to provide credentials for authenticating with Cassandra 1.2.4 cluster with valid credentials that has read & write permission on the given keyspace as follows: SimpleAuthProvider authProvider = new SimpleAuthProvider(); authProvider.add("user", "password"); Cluster cluster = Cluster.builder() .withAuthInfoProvider(authProvider) .... .build(); But when I execute the code to create this cluster, I get the following exception: java.lang.ClassCastException: org.apache.cassandra.transport.messages.AuthenticateMessage cannot be cast to org.apache.cassandra.transport.messages.ErrorMessage at com.datastax.driver.core.Connection.initializeTransport(Connection.java:157) at com.datastax.driver.core.Connection.<init>(Connection.java:118) at com.datastax.driver.core.Connection.<init>(Connection.java:90) at com.datastax.driver.core.Connection$Factory.open(Connection.java:376) at com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:203) at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:166) at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:83) at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:548) at com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:533) 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:484)

    DataStax JIRA | 4 years ago | Tran Huynh
    java.lang.ClassCastException: org.apache.cassandra.transport.messages.AuthenticateMessage cannot be cast to org.apache.cassandra.transport.messages.ErrorMessage

    Root Cause Analysis

    1. java.lang.ClassCastException

      org.apache.cassandra.transport.messages.AuthenticateMessage cannot be cast to org.apache.cassandra.transport.messages.ErrorMessage

      at com.datastax.driver.core.Connection.initializeTransport()
    2. DataStax Java Driver for Apache Cassandra - Core
      Cluster$Builder.build
      1. com.datastax.driver.core.Connection.initializeTransport(Connection.java:157)
      2. com.datastax.driver.core.Connection.<init>(Connection.java:118)
      3. com.datastax.driver.core.Connection.<init>(Connection.java:90)
      4. com.datastax.driver.core.Connection$Factory.open(Connection.java:376)
      5. com.datastax.driver.core.ControlConnection.tryConnect(ControlConnection.java:203)
      6. com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:166)
      7. com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:83)
      8. com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:548)
      9. com.datastax.driver.core.Cluster$Manager.<init>(Cluster.java:533)
      10. com.datastax.driver.core.Cluster.<init>(Cluster.java:65)
      11. com.datastax.driver.core.Cluster.buildFrom(Cluster.java:93)
      12. com.datastax.driver.core.Cluster$Builder.build(Cluster.java:484)
      12 frames