0

Upgrading spring version from 3.0.5.RELEASE to 5.3.17. After changing the version and build deployment, Following error is happening.

"org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'xxDao' defined in ServletContext resource [/WEB-INF/xxxx.xml]: Post-processing of merged bean definition failed; nested exception is java.lang.NoSuchMethodError: javax/persistence/PersistenceContext.synchronization()Ljavax/persistence/SynchronizationType; (loaded from file: .../WebSphere/AppServer/plugins/javax.j2ee.persistence.jar by org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader@4fdd22cb) called from class org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor$PersistenceElement"

From the above error, could see synchronization method is fetching from WebSphere location(extracted the javax.j2ee.persistence.jar and there is no such method). But previously also that jar was there before upgrading the spring version and was working fine. As workaround, tried to add javax.persistence-api-2.2.jar. But still trying to load from Websphere location.

Please help

Arun Rajan
  • 1
  • 1
  • 3
  • See if this is helpful https://medium.com/@james.tran/how-to-deploy-spring-boot-2-x-apps-on-websphere-8-5-5-d0b2e257f606 – Chetan Ahirrao Jun 15 '22 at 06:43
  • Or this : https://stackoverflow.com/questions/60373343/am-having-an-issue-deploying-spring-boot-2-2-1-solution-on-websphere-8-5-5-16. By the way, what version of WebSphere are you using ? – racraman Jun 15 '22 at 07:32
  • You upgrade about 10 versions of Spring (not counting the patch releases) with that you also upgraded to a new baseline version. Which means Spring 5.3 requires JPA 2.1, whereas your WebSphere versions ships with a JPA API (and implementation) that is lower. You probably include Hibernate and JPA api in your war/ear (at least I hope) if so change the classloading order in WebSphere to parent-last (or application-first or whatever it is called nowadays). If that isn't possible, you cannot upgrade to Spring 5.3 due to the new baseline versions which aren't supported by your WAS version. – M. Deinum Jun 15 '22 at 09:38
  • @racraman my websphere version is 8.5.5.19 with base version 8.5.5.9 – Arun Rajan Jun 22 '22 at 07:07
  • @M.Deinum , can we upgrade websphere compatible to spring version 5.3.17 – Arun Rajan Jun 22 '22 at 07:08
  • I have, luckily, been too long out of the websphere world. As stated switch classloading order to fix. – M. Deinum Jun 22 '22 at 07:14

0 Answers0