1

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-att-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)
Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183

2 Answers2

2

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.

maximdim
  • 8,041
  • 3
  • 33
  • 48
  • All my schemas are inside of the webapp, so no internet connection should be needed. Only external thing referred by my schemas is the XML Schema namespace itself (e.g. xmlns:xsd="http://www.w3.org/2001/XMLSchema" ). – Juha Syrjälä Nov 03 '10 at 15:40
  • @Juha Syrjälä: Just the fact that your schemas are inside webapp doesn't mean that parser will be able to locate them. After all they could be anywhere - in the classpath, among JSPs, in META-INF and so on. This is what XML Catalogs are for - to map namespace into actual location of the schema, otherwise parser would try to pull it from URL specified.I'm almost certain that this is what happening in your case. Just to eliminate other possibilities try to run Jetty disconnected and see if the same error would happen. – maximdim Nov 04 '10 at 00:50
  • I tried to run Jetty on same machine as Resin. Jetty worked without problems. – Juha Syrjälä Nov 04 '10 at 11:12
1

I don't know why this error occurred but the working solution is to upgrade to Resin 3.1.10.

Juha Syrjälä
  • 33,425
  • 31
  • 131
  • 183