Java “NoSuchMethodError”

后端 未结 7 562
天涯浪人
天涯浪人 2020-12-20 11:02

I\'m getting:

NoSuchMethodError: com.foo.SomeService.doSmth()Z

Am I understanding correctly that this \'Z\' means that return

7条回答
  •  北海茫月
    2020-12-20 11:31

    This is probably a difference between your compile-time classpath and you run-time classpath.

    Here is what seems to be going on:

    • The code is compiled with a class path that defines the doSmth() method returning a boolean. The byte-code refers to the doSmth()Z method.
    • At runtime, the doSmth()Z method isn't found. A method returning a Collection is found instead.

    To correct this problem, check your (compile time) classpath.

提交回复
热议问题