Andriy
Andriy

Reputation: 2111

Java 15 - unsupportedoperationexception: can't get field offset on a hidden class

Java 15, java-driver-core 4.15.0 and cassandra-unit 4.3.1.0 is used in the test.

When I trying to prepare statement in my test using cqlSession from EmbeddedCassandraServerHelper - I get 'com.datastax.oss.driver.api.core.AllNodesFailedException' exception. With message:

All 1 node(s) tried for the query failed (showing first 1 nodes, use getAllErrors() for more): Node(endPoint=localhost/127.0.0.1:9142, hostId=4e8b27ae-79f5-496a-a4ed-8ce0cb7bbb32, hashCode=aa1d75e): [com.datastax.oss.driver.api.core.servererrors.ServerError: java.lang.UnsupportedOperationException: can't get field offset on a hidden class: private final org.apache.cassandra.db.ClusteringComparator org.apache.cassandra.db.ClusteringComparator$$Lambda$143/0x0000000800d87768.arg$1]

With Java 14 it works fine. So does Java 15 really not work properly with EmbeddedCassandraServerHelper?

Code sample:

    public CqlSession cqlSession;

    @Before
    public void setUp() throws Exception {
        EmbeddedCassandraServerHelper.startEmbeddedCassandra();
        cqlSession = EmbeddedCassandraServerHelper.getSession();
        new CQLDataLoader(cqlSession)
            .load(new ClassPathCQLDataSet("people.cql"));
        
        PreparedStatement ps = cqlSession.prepare("INSERT INTO person(id, name) values(?,?)");
        BoundStatement bs = ps.bind("1234","Mike");
        cqlSession.execute(bs);
    }

people.cql:

CREATE TABLE person(
    id varchar,
    name varchar,
    PRIMARY KEY(id));

Upvotes: 1

Views: 1814

Answers (0)

Related Questions