users@jaxb.java.net

RE: Re: meaning of "URI was not reported to parser for entity"?

From: Andrew Ferguson <Andrew.Ferguson_at_arm.com>
Date: Thu, 20 May 2004 18:26:44 +0100

> How are you invoking JAXB? How is it reported to you? Got
> some stack trace? What's the instance?

hi,

 I'm throwing a RuntimeException in a ValidationHandler (this is for
testing purposes..) and the unmarshaller has been set to be
non-validating. The exception is only been thrown when run under junit
from inside ANT, there is also a custom classloader involved. JUnit has
its own classloading problems when combined with ANT so its possible
that this is something to do with it?

    [junit] java.lang.RuntimeException: XML is bad: XML parsing event:
\\filer\home\aferguso\work\i2work\testing\productPairs\ppTest1\Warehouse
1\C\N\V\Top\product.xml (line 1) URI was not reported to parser
for entity
[document]
    [junit] at
warehouse.jaxb.JAXBRootCache$MyValidationHandler.handleEvent(JAXBRootCac
he.java:140)
    [junit] at
warehouse.jaxb.wxml.impl.runtime.SAXUnmarshallerHandlerImpl.handleEvent(
SAXUnmarshallerHandlerI
mpl.java:533)
    [junit] at
warehouse.jaxb.wxml.impl.runtime.ErrorHandlerAdaptor.propagateEvent(Erro
rHandlerAdaptor.java:86
)
    [junit] at
warehouse.jaxb.wxml.impl.runtime.ErrorHandlerAdaptor.warning(ErrorHandle
rAdaptor.java:56)
    [junit] at gnu.xml.aelfred2.SAXDriver.warn(SAXDriver.java:935)
    [junit] at
gnu.xml.aelfred2.SAXDriver.startExternalEntity(SAXDriver.java:631)
    [junit] at
gnu.xml.aelfred2.XmlParser.pushURL(XmlParser.java:3358)
    [junit] at
gnu.xml.aelfred2.XmlParser.doParse(XmlParser.java:159)
    [junit] at gnu.xml.aelfred2.SAXDriver.parse(SAXDriver.java:320)
    [junit] at gnu.xml.aelfred2.XmlReader.parse(XmlReader.java:294)
    [junit] at
warehouse.jaxb.wxml.impl.runtime.UnmarshallerImpl.unmarshal(Unmarshaller
Impl.java:136)
    [junit] at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:131)
    [junit] at
javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmars
hallerImpl.java:178)
    [junit] at
warehouse.jaxb.JAXBRootCache.fetch(JAXBRootCache.java:65)

If it is a classpath problem then its not like normal classpath problems
(eg where the jaxb.properties file is not found) because parsing does
still work if I don't throw the exception from within the
ValidationHandler.

The string "URI was not reported to parser for entity" is returned from
ValidationEvent.getMessage()

Another variable is that the XML being parsed does not have a DOCTYPE
element after "<?xml version='1.0'?>", which sounds a plausible
interpretation of the error message - but I don't see why this would
only occur when being run in junit under ANT?

any help appreciated,
thanks,
Andrew


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_jaxb.dev.java.net
For additional commands, e-mail: users-help_at_jaxb.dev.java.net