Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.5.3
-
None
-
Unknown
Description
Some ws-rm scenarios such as those in systests/ws-rm with no RMAssertion reference (e.g., persistent.xml) are failing when there is no internet connection. The exception is shown as:
java.lang.RuntimeException: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 75 in XML document from class path resource [org/apache/cxf/systest/ws/rm/persistent.xml] is invalid; nested exception is org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'wsrmp:RMAssertion' to a 'element declaration' component.
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:124)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:97)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:69)
at org.apache.cxf.systest.ws.rm.ClientPersistenceTest$Server.run(ClientPersistenceTest.java:80)
at org.apache.cxf.testutil.common.AbstractTestServerBase.start(AbstractTestServerBase.java:68)
at org.apache.cxf.systest.ws.rm.ClientPersistenceTest$Server.main(ClientPersistenceTest.java:106)
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 75 in XML document from class path resource [org/apache/cxf/systest/ws/rm/persistent.xml] is invalid; nested exception is org.xml.sax.SAXParseException:src-resolve: Cannot resolve the name 'wsrmp:RMAssertion' to a 'element declaration' component.
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.doLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:115)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.internalLoadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:154)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.access$0(ControlledValidationXmlBeanDefinitionReader.java:153)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader$1.run(ControlledValidationXmlBeanDefinitionReader.java:141)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader$1.run(ControlledValidationXmlBeanDefinitionReader.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.bus.spring.ControlledValidationXmlBeanDefinitionReader.loadBeanDefinitions(ControlledValidationXmlBeanDefinitionReader.java:139)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:122)
at org.apache.cxf.bus.spring.BusApplicationContext.loadBeanDefinitions(BusApplicationContext.java:309)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:130)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)
at org.apache.cxf.bus.spring.BusApplicationContext$1.run(BusApplicationContext.java:101)
at org.apache.cxf.bus.spring.BusApplicationContext$1.run(BusApplicationContext.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.apache.cxf.bus.spring.BusApplicationContext.<init>(BusApplicationContext.java:99)
at org.apache.cxf.bus.spring.SpringBusFactory.createApplicationContext(SpringBusFactory.java:130)
at org.apache.cxf.bus.spring.SpringBusFactory.createBus(SpringBusFactory.java:121)
... 5 more
Caused by: org.xml.sax.SAXParseException: src-resolve: Cannot resolve the name 'wsrmp:RMAssertion' to a 'element declaration' component.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:
195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaErr(XSDHandler.java:2537)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2528)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getGlobalDecl(XSDHandler.java:1396)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:160)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:2049)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:582)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2437)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1782)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:705)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
at org.apache.cxf.bus.spring.TunedDocumentLoader.loadDocument(TunedDocumentLoader.java:116)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
... 26 more
The import statement in wsrm-manager.xsd currently imports wsrm-policy.xsd from the same relative path, as
<xs:import namespace="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" schemaLocation="wsrm-policy.xsd"/>
which implies wsrm-policy.xsd resides in the same path as in wsrm-manager.xsd, which is located at http://cxf.apache.org/schemas/configuration/. However, this will not match the schema catalog entry for this schema:
http\://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd=schemas/configuration/wsrm-policy.xsd
As wsrm-policy.xsd is a public schema, we should make wsrm-manager.xsd import wsrm-policy.xsd using its public location that matches the catalog file and let the catalog file resolve it to its local copy (so that it will also work without the internet connection).
That means, the import statement should be given as:
<xs:import namespace="http://schemas.xmlsoap.org/ws/2005/02/rm/policy" schemaLocation="http://schemas.xmlsoap.org/ws/2005/02/rm/wsrm-policy.xsd"/>