Home > Software engineering >  NoSuchMethodError in Vertx when hitting an API
NoSuchMethodError in Vertx when hitting an API

Time:06-03

I am using Vertx to manage APIs. When I hit the API, I get a NoSuchMethodError. The error is given below:

io.vertx.ext.web.RoutingContext - Unhandled exception in router java.lang.NoSuchMethodError: 'void io.vertx.ext.web.impl.RoutingContextDecorator.(io.vertx.ext.web.Route, io.vertx.ext.web.impl.RoutingContextInternal)'

Can anyone help on what could be causing this error?

CodePudding user response:

  • What can cause NoSuchMethodError with provided exception message ?

As exception suggests, it thrown if an application tries to call a specified method of a class (either static or instance), and that class no longer has a definition of that method. Normally, this error is caught by the compiler; this error can only occur at run time if the definition of a class has incompatibly changed, specifically in your provided message it located on RoutingContextDecorator void method, see more in here.

CodePudding user response:

The most likely case for this error is that your project is including vert.x dependencies with different versions. For example, vert.x core is 4.3.1 and vert.x web is 4.2.7.

I'd recommend you to use your build tool or IDE to verify the versions of the dependencies your project is using and make sure that they all align to the same semver.

  • Related