Problem with loading XML Schema document in Resin and Spring-WS
I am getting following exception when trying to load a XML Schema file in Resin 3.0.25
container. The schema file does not refer anything external besides XML Schema namespace (http://www.w3.org/2001/XMLSchema).
The XML Schema file is valid and exact same code works when using a Jetty
container.
The machine that runs Resin is has no access to internet, and machine running Jetty has internet access.
Caused by: org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'xsdSchema' threw exception; nested exception is org.springframework.xml.validation.XmlValidationException: C
ould not create Schema: s4s-att-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot resolve 'xsd:string' as a QName: the prefix 'xsd
' is not declared.; nested exception is org.xml.sax.SAXParseException: s4s-a开发者_开发百科tt-invalid-value: Invalid attribute value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix: Cannot r
esolve 'xsd:string' as a QName: the prefix 'xsd' is not declared.
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:104)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1198)
... 48 more
I have tried different XML parsers like this but it does not seem to have any effect.
-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
What could be the reason for this behaviour?
Edit: With a bit different spring configuration I am getting this stacktrace
org.xml.sax.SAXParseException: s4s-att-invalid-value: Invalid attribute
value for 'base' in element 'restriction'. Recorded reason: UndeclaredPrefix:
Cannot resolve 'xsd:string' as a QName: the prefix 'xsd' is not declared.
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.reportSchemaError(XSDHandler.java:2525)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.reportSchemaError(XSAttributeChecker.java:1608)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes(XSAttributeChecker.java:1175)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSAttributeChecker.checkAttributes(XSAttributeChecker.java:996)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.getSimpleType(XSDSimpleTypeTraverser.java:221)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseSimpleTypeDecl(XSDSimpleTypeTraverser.java:142)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDSimpleTypeTraverser.traverseGlobal(XSDSimpleTypeTraverser.java:102)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseSchemas(XSDHandler.java:1267)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:579)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:552)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:519)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:485)
at com.sun.org.apache.xerces.internal.jaxp.validation.XMLSchemaFactory.newSchema(XMLSchemaFactory.java:206)
at org.springframework.xml.validation.SchemaLoaderUtils.loadSchema(SchemaLoaderUtils.java:77)
Probably without internet connection it can't download schema for XSD. You can probably try to use XML Catalog to point to schema available locally.
I don't know why this error occurred but the working solution is to upgrade to Resin 3.1.10.
精彩评论