XmlSchemaCollection.read()的NoSuchMethodError

Kre*_*vat 5 java xml spring

我继续为XmlSchemaCollection.read(Lorg/xml/sax/InputSource;)设置NoSuchMethodError,我发现旧版本的XMLSchema存在问题: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
Run Code Online (Sandbox Code Playgroud)

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>
Run Code Online (Sandbox Code Playgroud)

架构集合bean

<bean id="schemaCollection" class="org.springframework.xml.xsd.commons.CommonsXsdSchemaCollection">
    <property name="xsds" value="/message.xsd"/>
    <property name="inline" value="true"/>
</bean>
Run Code Online (Sandbox Code Playgroud)

cxu*_*rix 4

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

mvn dependency:tree
Run Code Online (Sandbox Code Playgroud)

如果您在 dome 其他库中看到 xmlschema-core 作为依赖项,则尝试通过对父依赖项使用排除来排除它, 请参阅依赖项排除