Yassine Badache
Yassine Badache

Reputation: 1851

Workaround for conflict between Spring OXM and Spring Core

I have a project which is using Spring OXM Tiger. I have to upgrade a proprietary framework, which is using Spring Core (4.2.8), and I have a compatibility problem.

As the framework is upgrading the Spring framework from 3.0.x to 4.2.8, I tumble on the following exception:

java.lang.NoSuchMethodError: org.springframework.util.ClassUtils.forName(Ljava/lang/String;)Ljava/lang/Class;
at org.springframework.oxm.jaxb.JaxbUtils.<clinit>(JaxbUtils.java:44)
at org.springframework.oxm.jaxb.Jaxb2Marshaller.createJaxbContext(Jaxb2Marshaller.java:272)
at org.springframework.oxm.jaxb.AbstractJaxbMarshaller.afterPropertiesSet(AbstractJaxbMarshaller.java:125)

It happens, indeed, that JaxbUtils is calling ClassUtils.forName(Ljava/lang/String;) from the Spring Core dependency:

Class Jaxbutils from Spring Oxm 1.5.8:

static {
    try {
        ClassUtils.forName(JAXB_2_CLASS_NAME);
        jaxbVersion = JAXB_2;
    }
    catch (ClassNotFoundException ex) {
        // leave JAXB 1 as default
    }
}

However, Spring Core 4.2.8.RELEASE does not provide this signature anymore:

Class ClassUtils from Spring Core 4.2.8:

public static Class<?> forName(String name, ClassLoader classLoader) throws ClassNotFoundException, LinkageError {

At the moment, I need Spring OXM Tiger to use StringSource, XPathOperations, Jaxb2Marshaller, etc ... But it won't actually work with the current version of Spring Core.

I couldn't find any workaround to use marshalling/unmarshalling and XPath operations using Spring Core 4.2.8 and another version of Spring OXM Tiger.

What can I do to work around this problem ? I'm kind of stuck. Is there a way to not use Spring OXM and still work with XPath and Jaxb2Marshallers ?

Thank you,

Upvotes: 0

Views: 1766

Answers (1)

R.Litto
R.Litto

Reputation: 403

Probably it is late, but did you try using org.springframework:spring-oxm instead of org.springframework.ws:spring-oxm and getting rid of spring-oxm-tiger completely?

Upvotes: 1

Related Questions