com.datastax.driver.core.exceptions.InvalidQueryException: Tried to execute unknown prepared query

19 Views Asked by At

com.datastax.driver.core.exceptions.InvalidQueryException: Tried to execute unknown prepared query . You may have used a PreparedStatement that was created with another Cluster instance

Facing this issue after upgrading application from java 8 to java 17.

Currently we are using datastax driver core 3.3.0 with 3.11.7 cassandra server

private ResultSet execute(BoundStatement boundStatement) {
    queryLogger.debug("Executing : {}", boundStatement.preparedStatement().getQueryString());
    ResultSet resultSet = getSession(boundStatement).execute(boundStatement);
    return resultSet;
}

throwing this error while getSession() of method called. `getSession() method implemntation is like this

private Session getSession(BoundStatement boundStatement) {
    return cassandraConfiguration.getSession(boundStatement.preparedStatement().getQueryKeyspace());
}

public Session getSession(String keyspace) {
    if (!sessionCache.containsKey(keyspace)) {
        sessionCache.put(keyspace, createSession(keyspace));
    }
    return sessionCache.get(keyspace);
}
0

There are 0 best solutions below