本文主要是介绍java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Docu,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
日志如下:
[ERROR] 2022-05-19 11:15:51,259 org.springframework.web.context.ContextLoader(ContextLoader.java:319) -5389 [localhost-startStop-1] - Context initialization failedorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'projectService': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1482)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:389)at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:294)at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:112)at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5181)at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5704)at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:1018)at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:994)at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:1127)at org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:2021)at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)at java.util.concurrent.FutureTask.run(FutureTask.java:262)at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Document;Ljava/lang/String;)Lorg/apache/ws/commons/schema/XmlSchema;at org.apache.cxf.common.xmlschema.SchemaCollection.read(SchemaCollection.java:133)at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:193)at org.apache.cxf.databinding.AbstractDataBinding.addSchemaDocument(AbstractDataBinding.java:96)at org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:388)at org.apache.cxf.service.factory.AbstractServiceFactoryBean.initializeDataBindings(AbstractServiceFactoryBean.java:86)at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:467)at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.buildServiceFromClass(JaxWsServiceFactoryBean.java:696)at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:527)at org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:261)at org.apache.cxf.jaxws.support.JaxWsServiceFactoryBean.create(JaxWsServiceFactoryBean.java:199)at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:102)at org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:168)at org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:211)at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:460)at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:338)at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:543)at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)at java.lang.reflect.Method.invoke(Method.java:606)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1608)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1549)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)... 25 more
原因:
xmlschema-core-2.2.1和XmlSchema-1.4.7这两个包都有这个类。
解决办法:
删除jar包中的XmlSchema
这篇关于java.lang.NoSuchMethodError: org.apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/w3c/dom/Docu的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!