'Spring upgrade from 4.1.6 to 5.2.20 results to org.springframework.core.ResolvableType
Because of the Spring4Shell issue, we are trying to upgrade Spring from 4.1.6 to 5.2.20. The application is running in WF26 and JDK17. When I start the application, the below error is thrown:
Caused by: java.lang.NoSuchMethodError: 'org.springframework.core.ResolvableType org.springframework.core.ResolvableType.forRawClass(java.lang.Class)' at deployment.le5.ear//org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanNamesForType(DefaultListableBeanFactory.java:495) at deployment.le5.ear//org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:82) at deployment.le5.ear//org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:606) at deployment.le5.ear//org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:462) at deployment.le5.ear//org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139) at deployment.le5.ear//org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83) at deployment.le5.ear.le5.jar//com.versasys.licenseEase.service.ejb.job.BatchJobService.(BatchJobService.java:63)
The below code snippet is the one that throws the error:
static {
batchJobAppContext = new ClassPathXmlApplicationContext(BATCH_JOB_SPRING_BEANS);
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd" >
<bean id="BatchTaskWrap"
class="com.versasys.test.service.ejb.job.BatchTaskWrap" >
</bean>
</beans>
org.springframework.beans.factory.support.DefaultListableBeanFactory is under spring-beans*.jar. If I use version 4.1.6 for spring beans(the other spring jars are 5.2.20), it does work. However, if I use spring-beans 5.2.20, that's the time I'm having problems.
org.springframework.core.ResolvableType.forRawClass(java.lang.Class) is in version 5.2.20 so I'm suspecting that the application is still loading 4.1.6 version. I already scanned by code and I no longer see anything the uses 4.1.6. Currently, the jar files are stored in my local instead of defining it in pom.xml
Hope you can help me with this. Thank you!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
