Spring 3.0.2とXmlSchema.jar 1.4.7を含むJavaプロジェクトがあります
プロジェクトのpom.xmlには依存関係として含まれています:
<dependency>
<groupId>org.Apache.ws.commons.schema</groupId>
<artifactId>XmlSchema</artifactId>
<version>1.4.7</version>
</dependency>
プロジェクトは正常にコンパイルされますが、コンテキストページにアクセスすると、次のエラーが報告されます。
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'schemaCollection' defined in class path resource [applicationContext-jdeInterfaceService.xml]: Invocation of init method failed; nested exception is Java.lang.NoSuchMethodError: org.Apache.ws.commons.schema.XmlSchemaCollection.read(Lorg/xml/sax/InputSource;)Lorg/Apache/ws/commons/schema/XmlSchema;
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.Java:1455)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.Java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.Java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.Java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:464)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.Java:631)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.Java:588)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.Java:645)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.Java:508)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.Java:449)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.Java:133)
at javax.servlet.GenericServlet.init(GenericServlet.Java:160)
at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1266)
at org.Apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.Java:1185)
at org.Apache.catalina.core.StandardWrapper.allocate(StandardWrapper.Java:857)
at org.Apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:136)
at org.Apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:169)
at org.Apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.Java:472)
at org.Apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:168)
at org.Apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.Java:98)
at org.Apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.Java:927)
at org.Apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.Java:118)
at org.Apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:407)
at org.Apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.Java:999)
at org.Apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.Java:565)
at org.Apache.Tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.Java:307)
at Java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.Java:886)
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:908)
at Java.lang.Thread.run(Thread.Java:662)
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)
... 33 more
20/08/2012 12:05:35 PM org.Apache.catalina.core.StandardWrapperValve invoke
SEVERE: Allocate exception for servlet spring-ws
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)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.Java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.Java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.Java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.Java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.Java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.Java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.Java:585)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.Java:913)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:464)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.Java:631)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.Java:588)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.Java:645)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.Java:508)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.Java:449)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.Java:133)
at javax.servlet.GenericServlet.init(GenericServlet.Java:160)
at org.Apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.Java:1266)
at org.Apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.Java:1185)
at org.Apache.catalina.core.StandardWrapper.allocate(StandardWrapper.Java:857)
at org.Apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.Java:136)
at org.Apache.catalina.core.StandardContextValve.invoke(StandardContextValve.Java:169)
at org.Apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.Java:472)
at org.Apache.catalina.core.StandardHostValve.invoke(StandardHostValve.Java:168)
at org.Apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.Java:98)
at org.Apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.Java:927)
at org.Apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.Java:118)
at org.Apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.Java:407)
at org.Apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.Java:999)
at org.Apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.Java:565)
at org.Apache.Tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.Java:307)
at Java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.Java:886)
at Java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.Java:908)
at Java.lang.Thread.run(Thread.Java:662)
正しい依存関係は
<dependency>
<groupId>org.Apache.ws.xmlschema</groupId>
<artifactId>xmlschema-core</artifactId>
<version>2.0.1</version>
</dependency>
よろしく
アンシュル・カッタ
依存関係を2.0.1または2.0.2に変更してください
レガシー1.4.7にはメソッドが定義されていません
public XmlSchema read(Source source) {
if (source instanceof SAXSource) {
return read(((SAXSource)source).getInputSource());
}
1.4.x javadoc および 2.x javadoc を確認してください
リポジトリ内のApache XmlSchemaの最新バージョンを確認します http://mvnrepository.com/artifact/org.Apache.ws.xmlschema/xmlschema-core
WebLogicには独自の実装クラスがあるため、これらの手順は必ずしもWebLogicで機能しません。 Anshulが示すように依存関係を更新した後、weblogic-application.xmlでそのパッケージを優先するようにWebLogicに指示する必要もあります。
<wls:prefer-application-packages>
<wls:package-name>org.Apache.ws.commons.schema</wls:package-name>
</wls:prefer-application-packages>
まず、プロジェクトクラスパスからcxf-bundle-xxx.jar(存在する場合)を削除する必要があります。次に、最新のxmlschema-core.jarを検索して、クラスパスに追加します。
私の場合、クラスパスからcxf-bundle-2.3.1.jarを削除し、クラスパスにxmlschema-core-2.0.1を追加しましたが、これは正常に機能しています。
それが役立つことを願っています。