Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NoSuchMethodError for XmlSchemaCollection.read()

Tags:

java

spring

xml

I keep geting NoSuchMethodError for XmlSchemaCollection.read(Lorg/xml/sax/InputSource;), I found that there is problem in older versions of XMLSchema What happened to: org.apache.ws.commons.schema.XmlSchemaCollection.read(InputSource). I changed maven dependency but error keep repeating.

Caused by: java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/xml/sax/InputSource;)Lorg/apache/ws/commons/schema/XmlSchema;
at org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection.afterPropertiesSet(CommonsXsdSchemaCollection.java:137)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1514)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1452)
... 55 more

maven dependency

<dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-xml</artifactId>
        <version>2.1.0.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.apache.ws.xmlschema</groupId>
        <artifactId>xmlschema-core</artifactId>
        <version>2.0.3</version>
    </dependency>

schema collection bean

<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    <property name="xsds" value="/message.xsd"/>
    <property name="inline" value="true"/>
</bean>
like image 577
Kresimir Horvat Avatar asked Oct 06 '22 10:10

Kresimir Horvat


1 Answers

It might be that some other library is depending on older version of xmlschema-core. check

mvn dependency:tree

if you see xmlschema-core in dome other library as dependency, then try to exclude it by using exclusion on parent dependency see Dependency Exclusions

like image 197
cxubrix Avatar answered Oct 09 '22 01:10

cxubrix