我不断收到XmlSchemaCollection.read(Lorg/xml/sax/InputSource;)的NoSuchMethodError,发现旧版本的XMLSchema What happened to: org.apache.ws.commons.schema.XmlSchemaCollection.read(InputSource)存在问题。
我更改了Maven依赖关系,但错误不断重复。

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>
        <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>

模式收集bean
<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    <property name="xsds" value="/message.xsd"/>
    <property name="inline" value="true"/>
</bean>

最佳答案

可能其他某个库依赖于xmlschema-core的旧版本。
查看

mvn dependency:tree

如果您在穹顶其他库中看到xmlschema-core作为依赖项,则尝试通过对父项依赖项进行排除来排除它
see Dependency Exclusions

关于java - XmlSchemaCollection.read()的NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12729062/

10-10 17:24