newrelic / newrelic-java-agent

The New Relic Java agent
Apache License 2.0
202 stars 143 forks source link

java.lang.NoSuchMethodError: com.nr.agent.instrumentation.cassandra.CassandraUtils.wrapSyncRequest #1991

Closed amar-kopric closed 1 month ago

amar-kopric commented 3 months ago

I recently upgraded my maven project from spring boot 2.1 to 2.7 in which I utilize the newrelic-api dependency for some custom metrics. After the upgrade my cassandra queries keep failing with the following error:

com.nr.agent.instrumentation.cassandra.CassandraUtils.wrapSyncRequest(Lcom/datastax/oss/driver/api/core/cql/Statement;Lcom/datastax/oss/driver/api/core/cql/ResultSet;Lcom/datastax/oss/driver/api/core/CqlIdentifier;Lcom/newrelic/api/agent/Segment;)Lcom/datastax/oss/driver/api/core/cql/ResultSet;]

Looking at the changelogs for both spring boot and newrelic, I found out that the datastax library has been upgraded to version 4.x with the spring boot upgrade and that the newrelic agent now has the support for the datastax version 4.x.

Is the only solution to fixing this to include the newrelic-agent dependency along side the newrelic-api dependency? Since I can see that some projects have even newer version of spring boot and datastax and don't need to include the newrelic-agent dependency and their cassandra queries are working just fine.

workato-integration[bot] commented 3 months ago

https://new-relic.atlassian.net/browse/NR-296020

amar-kopric commented 2 months ago

To add to this, we have tried adding the newrelic-agent dependency in our project but the we did not resolve the issue. The only current workaround is to disable the datastax4 instrumentation in the newrelic.yml file like so:

class_transformer: com.newrelic.instrumentation.cassandra-datastax-4.0.0: enabled: false

This help us keep our endpoints/services working but without instrumentation

deleonenriqueta commented 2 months ago

@amar-kopric Thanks for the update!

Can you please provide me with the last working version of the driver as well as the version of the driver that results in failing Cassandra queries?

amar-kopric commented 2 months ago

hi @deleonenriqueta, so we are keeping the new-relic agent fairly up-to-date, we have been on the version 8.7 for the past 6 months and everything was working fine until we upgraded spring-boot version of our app from 2.1 to 2.7 which now includes the datastax 4.0 drivers. Now since our queries are executed with this newer library are queries are failing. Also something we noticed is that this does not happen with our gradle project, since we have a project with similar library versions (spring-boot 2.7, datastax4.0, new-relic agent 8.7)

deleonenriqueta commented 2 months ago

Hello @amar-kopric, with the information provided I've tried reproducing the NoSuchMethodError but queries are not failing on my end. I've tested querying Cassandra with multiple methods (query builder, explicit CQL statements, mapper). If you're able to provide me with the following information, I can continue to investigate the issue:

deleonenriqueta commented 1 month ago

Marking this issue as wontfix and closing it out since we've had no reply for several weeks.