java XmlSchemaCollection.read() 的 NoSuchMethodError

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12729062/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 09:59:41  来源:igfitidea点击:

NoSuchMethodError for XmlSchemaCollection.read()

javaxmlspring

提问by Kresimir Horvat

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.

我一直收到 NoSuchMethodError for XmlSchemaCollection.read(Lorg/xml/sax/InputSource;),我发现旧版本的 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

maven dependency

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>

schema collection bean

模式集合 bean

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

回答by cxubrix

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

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

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

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

回答by StarCrafter

The other option is; if you have a problem or missing artifactId in your projects pom.xml, this problem persists too.

另一种选择是; 如果您的项目 pom.xml 中有问题或缺少 artifactId,则此问题也仍然存在。