dev@glassfish.java.net

Re: Schema parse error with web-app_2_5.xsd, Any clue??

From: Krishnamohan Meduri <Krishna.Meduri_at_Sun.COM>
Date: Wed, 23 Aug 2006 18:08:20 -0700

Jan Luehe wrote:

> Krishna,
>
> Krishnamohan Meduri wrote On 08/23/06 13:46,:
>
>> Hi,
>>
>> I use the following schema declaration in my web.xml:
>>
>> <web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee"
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
>> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
>>
>> I get a lot of parse errors, one of which I pasted below:
>>
>> org.xml.sax.SAXParseException: sch-props-correct.2: A schema cannot
>> contain two global components with the same name; this schema contains
>> two occurrences of
>> 'http://java.sun.com/xml/ns/javaee,service-ref_handler-name-key'.
>>
>>
>
> I had run into a similar issue when validating a web.xml schema
> from GlassFish's JSP compiler, see:
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6402288
>
> Notice the JSP compiler leverages the schema validation framework from
> JAXP 1.3 instead of commons-digester, but the fix I applied to the JSP
> compiler may give you an idea.

Thanks so much, Jan, for your response.
Although the exception stack is same, unlike the problem you described,
it worked fine for web-app_2_4.xsd but threw exception only for
web-app_2_5.xsd
I just found the cause. In DigesterFactory class, we are not registering
javaee_5.xsd with SchemaResolver.
After I registered, the problem went away. I will send you the code diff
shortly and you can review and commit it to glassfish.

Thanks,
-Krishna.

>
> Jan
>
>
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:236)
>>
>> at
>> com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:172)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:382)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2241)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.checkForDuplicateNames(XSDHandler.java:1918)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseNamedElement(XSDElementTraverser.java:407)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDElementTraverser.traverseLocal(XSDElementTraverser.java:214)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.traverseLocalElements(XSDHandler.java:1781)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:484)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:556)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.findSchemaGrammar(XMLSchemaValidator.java:2459)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1807)
>>
>> 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:330)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDispatcher.scanRootElementHook(XMLNSDocumentScannerImpl.java:779)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1794)
>>
>> at
>> com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:368)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:834)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:148)
>>
>> at
>> com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1242)
>>
>> at
>> com.sun.org.apache.commons.digester.Digester.parse(Digester.java:1548)
>>
>>
>> What could be wrong? Could it be a bug ?
>> Google showed http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4972882
>> but is not of much help
>>
>> Appreciate any response,
>> -Krishna.
>>
>>
>>