Skip to content

NoSuchMethodError if used in a project with Cats < 2.10 #957

@kubukoz

Description

@kubukoz

Discussed in #955

Originally posted by danicheg December 22, 2024
Saying this straight off the bat, this is not a Redis4Cats issue! However, IMHO, some awareness (read better visibility) for the issue I encountered should be raised.
TL;DR, if a project lacks the explicit dependency on Cats-Core but has both Cats-Effect (v3.5.7) and Redis4Cats (v1.7.2) — an NSME will be thrown:

[error] java.lang.NoSuchMethodError: 'java.lang.Object cats.syntax.ApplyOps$.$times$greater$extension(java.lang.Object, java.lang.Object, cats.Apply)'
[error] 	at dev.profunktor.redis4cats.connection.RedisClient$.$anonfun$acquireAndRelease$4(RedisClient.scala:45)
[error] 	at cats.effect.kernel.Resource$.$anonfun$make$1(Resource.scala:848)
[error] 	at cats.effect.IOFiber.runLoop(IOFiber.scala:343)
[error] 	at cats.effect.IOFiber.execR(IOFiber.scala:1362)
[error] 	at cats.effect.IOFiber.run(IOFiber.scala:112)
[error] 	at cats.effect.unsafe.WorkerThread.run(WorkerThread.scala:634)

That's unpleasant but until Cats-Effect is not on the current version of Cats-Core, the only possible solution is to have Cats-Core defined explicitly among the dependencies in a project. Again, there is nothing to be done on the Redis4Cats side.

See the complete minimal representation here https://github.com/danicheg/redis4cats-nsme-showcase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions