Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring bean java.lang.NoSuchMethodError error

I am getting below error, I believe its due to OLDER version of spring-beans.jar, In my LIB i have spring-beans--3.1.1.RELEASE.jar but still getting below error. I have deployed my application on WAS 8.5.X server.

java.lang.NoSuchMethodError: org/springframework/beans/MutablePropertyValues.add(Ljava/lang/String;Ljava/lang/Object;)Lorg/springframework/beans/MutablePropertyValues;

Is there any way to search on linux to find the culprit jar?

like image 834
Java hunger Avatar asked Jul 18 '26 08:07

Java hunger


1 Answers

You can check what jar file that class is loaded from, adding the line below to your Java program

System.out.println(System.class.getResource(
           "/org/springframework/beans/MutablePropertyValues.class"));

which should print something like

jar:file:/C:/my-program/lib/spring-beans-5.2.1.RELEASE.jar!/org/springframework/beans/MutablePropertyValues.class

or using Guava's Resources.getResource("org/springframework/beans/MutablePropertyValues.class");


NoSuchMethodError error usually means there is a mismatch between the version of that class and the version expected by its clients. It could eventually be the case that the spring-beans jar version is actually correct- if that is the case, it is worth checking the version of the code invoking it, too.

like image 67
Daniele Avatar answered Jul 21 '26 10:07

Daniele



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!