I am currently working on upgrading Jira Version to 8.6.0 and as part of this process I am working on upgrading a custom plugin.
While upgrading this plugin which has reference to org.springframework.ldap.core.LdapTemplate I observed a ClassCastException as below
Caused by: java.lang.ClassCastException: org.springframework.core.convert.support.DefaultConversionService cannot be cast to org.springframework.core.convert.support.GenericConversionService
On further investigation I found that this is because of the fact that DefaultConversionService class is loaded by 2 classloaders namely one from the plugin that is currently being upgraded and another one from Apache felix org.apache.servicemix.bundles.spring-core .
This version of JIRA uses spring-ldap-core version 2.3.2.RELEASE, spring-core 5.0.10.RELEASE and apache felix framework 5.6.12.RELEASE
I see that the above class cast exception was not thrown in earlier version of Jira (7.3.6) which had spring-ldap-core version 2.0.2.RELEASE, spring-core 4.1.6.RELEASE and apache felix framework version (4.2.1)
I tried to import OSGi package as below
However the above solution didn’t help.
I was able to resolve the ClassCastException by adding the package org.springframework.core.convert.support to -Datlassian.org.osgi.framework.bootdelegation property. This is something I found when I looked closer into org.apache.felix.framework.BundleWiringImpl class that was calling the shouldBootDelegate method.
This solution might not be the intended resolution as this can create a negative impact on other plugins.
Can you kindly let me know if there is any other solution to this problem?
Thanks & Regards,