我不断收到 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
如果您在 dome other library 中看到 xmlschema-core 作为依赖项,则尝试使用父依赖项排除来排除它 see Dependency Exclusions
关于java - XmlSchemaCollection.read() 的 NoSuchMethodError,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12729062/