scylladb / java-driver

ScyllaDB Java Driver for ScyllaDB and Apache Cassandra, based on the DataStax Java Driver
Apache License 2.0
63 stars 37 forks source link

NoSuchMethodError: com.datastax.driver.core.ResultSet.one()Lcom/datastax/driver/core/Row when updating to 3.11.5.x #306

Open FlorianHockmann opened 5 months ago

FlorianHockmann commented 5 months ago

We are using this driver for the Scylla backend of JanusGraph. For the Hadoop integration of JanusGraph, we still need to use version 3 of the driver. To be more precise, our dependency is on scylla-driver-core and we currently use version 3.11.2.4 there.

Dependabot has created a PR (JanusGraph/janusgraph#4464) to update the dependency, but some tests are now failing with a NoSuchMethodError:

Caused by: java.lang.NoSuchMethodError: 'com.datastax.driver.core.Row com.datastax.driver.core.ResultSet.one()'
        at org.apache.cassandra.hadoop.cql3.CqlInputFormat.describeSplits(CqlInputFormat.java:368)
        at org.apache.cassandra.hadoop.cql3.CqlInputFormat.getSubSplits(CqlInputFormat.java:345)
        at org.apache.cassandra.hadoop.cql3.CqlInputFormat$SplitCallable.call(CqlInputFormat.java:469)
        at org.apache.cassandra.hadoop.cql3.CqlInputFormat$SplitCallable.call(CqlInputFormat.java:450)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
        at java.base/java.lang.Thread.run(Thread.java:829)

We are using exactly the same code in another project of JanusGraph that is not specific for Scylla with the original driver in version 3.11.5. (To give some more background: JanusGraph has a general CQL backend where the original driver is used and then a Scylla backend which uses the same code but only switches the driver to this one.) Here, we don't have this problem. So, I would have expected version 3.11.5.x of this driver to work with the same code.

mykaul commented 5 months ago

90 changes between them - https://github.com/scylladb/java-driver/compare/3.11.2.4...3.11.5.3 - need to see what could have caused it.

Bouncheck commented 5 months ago

My vague recollection of this error message for this method is that there was some plugin checking backwards compatibility and it would sometimes complain even though nothing was changed. It may have been wrongly deleted just to satisfy that checker. If it truly is deleted we'll have to readd it and try to solve the problem with the plugin if that's what happened.

mykaul commented 5 months ago

@Bouncheck - https://github.com/scylladb/java-driver/commit/f54ec8c4567002b3be96224b662b6563d5041490 is probably the cause.

Bouncheck commented 4 months ago

@FlorianHockmann is it possible that when running those tests there is more than 1 driver on the classpath? I have trouble understanding why NoSuchMethodError occurs. Even though we have removed that method from ResultSet interface it was always present in parent interface, so it should not create issues when building from scratch.

dkropachev commented 3 months ago

@FlorianHockmann , I have tried to reproduce it, it never showed up, I have made it successfully complete following tests:

mvn clean install --projects janusgraph-scylla -DskipTests=true --batch-mode --also-make
mvn verify --projects janusgraph-scylla -Pcoverage  -Pscylla-murmur -Dtest="**/core/cql/*"

It is most-likely a mvn cache problem you have in the pipeline.

FlorianHockmann commented 3 months ago

@Bouncheck:

is it possible that when running those tests there is more than 1 driver on the classpath?

That should at least not be the case as we explicitly exclude the DataStax cassandra driver: https://github.com/JanusGraph/janusgraph/blob/master/scylla-hadoop-util/pom.xml#L25-L28

But I'm also not 100% sure whether the DataStax driver could still end up there somehow. Do you have any idea how I could check that?

@dkropachev: And you first applied the upate manually? Because I just tried it locally and could reproduce it that way. Just to be sure we are talking about the same scenario, here are the steps I took:

  1. Checkout master branch from JanusGraph/janusgraph.
  2. Updated the driver here from 3.11.2.4 to 3.11.5.3.
  3. Executed mvn clean install --projects janusgraph-scylla -DskipTests=true --batch-mode --also-make
  4. Executed mvn verify --projects janusgraph-scylla -Pcoverage -Pscylla-murmur -Dtest="**/core/cql/*"

This led to the expected test failure:

[ERROR] Tests run: 29, Failures: 0, Errors: 1, Skipped: 3, Time elapsed: 150.2 s <<< FAILURE! -- in org.janusgraph.core.cql.CQLConfiguredGraphFactoryTest
[ERROR] org.janusgraph.core.cql.CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace -- Time elapsed: 16.17 s <<< ERROR!
java.lang.NoSuchMethodError: 'com.datastax.driver.core.Row com.datastax.driver.core.ResultSet.one()'
        at org.janusgraph.core.cql.CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace(CQLConfiguredGraphFactoryTest.java:126)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
        at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:658)
        at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:274)
        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
        at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
        at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)
        at java.base/java.util.ArrayList.forEach(ArrayList.java:1541)

[ERROR] Surefire is going to kill self fork JVM. The exit has elapsed 30 seconds after System.exit(0).
[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR] org.janusgraph.core.cql.CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace
[ERROR]   Run 1: CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace Do not fail completely, but repeat the test
[ERROR]   Run 2: CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace Do not fail completely, but repeat the test
[ERROR]   Run 3: CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace Do not fail completely, but repeat the test
[ERROR]   Run 4: CQLConfiguredGraphFactoryTest.dropGraphShouldRemoveGraphKeyspace:126 NoSuchMethod 'com.datastax.driver.core.Row com.datastax.driver.core.ResultSet.one()'
[INFO]
[INFO]
[ERROR] Tests run: 26, Failures: 0, Errors: 1, Skipped: 0
dkropachev commented 3 months ago

@FlorianHockmann , just to update you, I have managed to reproduce it, but completely failed to find reason for it to happen.

It looks like this issue is happening only when you running this suite in a particular way via maven. I have extracted com.datastax.driver.core.ResultSet from build and it have one on it and it is working properly.