Can't find resource for bundle java.util.PropertyResourceBundle, key XML-0000
We are using Oracle J2EE MVC framework (aka Cleveland) to perform XSL Transforms. Generally, it works well, except if the XSL is malformed or otherwise in error. In that case, the error handling is a-bomb-in-all! I can't seem to get control of the TransformerFactory to capture the real error. Here's a console dump:
java.util.MissingResourceException: Can't find resource for bundle java.util.Pro
pertyResourceBundle, key XML-0000
at java.util.ResourceBundle.getObject(Unknown Source)
at java.util.ResourceBundle.getString(Unknown Source)
at oracle.xml.util.XMLError.getMessage1(XMLError.java:418)
at oracle.xml.util.XMLError.error1(XMLError.java:307)
at oracle.xml.jaxp.JXSAXTransformerFactory.reportConfigException(JXSAXTr
ansformerFactory.java:667)
at oracle.xml.jaxp.JXSAXTransformerFactory.newTemplates(JXSAXTransformer
Factory.java:357)
at oracle.xml.jaxp.JXSAXTransformerFactory.newTransformer(JXSAXTransform
erFactory.java:246)
at oracle.clex.process.RepairedXSLTransformationPage.printPage(RepairedX
SLTransformationPage.java:117)
at oracle.clex.process.CreatePage.start(CreatePage.java:64)
at oracle.cle.process.CLEStateMachine.start(CLEStateMachine.java:55)
at oracle.cle.process.Process.start(Process.java:97)
at oracle.cle.process.GenericProcess.start(GenericProcess.java:82)
at oracle.cle.process.ParentProcess.start(ParentProcess.java:218)
at oracle.cle.process.DisplayGroup.start(DisplayGroup.java:75)
at oracle.cle.process.CLEStateMachine.start(CLEStateMachine.java:55)
at oracle.cle.process.Service.start(Service.java:389)
at oracle.clex.process.controller.HttpServletController.doPost(HttpServl
etController.java:439)
at oracle.clex.process.controller.HttpServletController.doGet(HttpServle
tController.java:849)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:195)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:309)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:336)
at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletReque
stDispatcher.java:691)
at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(Ser
vletRequestDispatcher.java:276)
at com.evermind.server.http.HttpRequestHandler.processRequest(HttpReques
tHandler.java:737)
at com.evermind.server.http.HttpRequestHandler.run(HttpRequestHandler.ja
va:247)
at com.evermind.util.ThreadPoolThread.run(ThreadPoolThread.java:64)
The dump occurs for most XSL formatting errors. For instance, an include can't be found, or a template name is mungled. I am not including the XSL because it is not the XSL that is broken (well it is, but that's not the issue).
Here's a snapshot of the code being used:
// build the xml document
DOMSource xmlSource = buildDOMSource();
DOMSource xslSource = null;
// get the XSL stylesheet document
if (lookupPage)
{
xslSource =
getDocumentFromFile(lookupPageLocation(pageLocationKey));
} // end if
else
{
xslSource = getDocumentFromFile(xsltFileURLString);
} // end else
// Set system ID's on the sources if requested
if (xslDOMSystemID != null) {
xslSource.setSystemId(xslDOMSystemID);
}
if (xmlDOMSystemID != null) {
xmlSource.setSystemId(xmlDOMSystemID);
}
// create a handler
//ErrorListener pl = new ParserListener();
// Create a new instance of the JAXP transformer factory
TransformerFactory factory = TransformerFactory.newInstance();
//factory.setErrorListener(pl);
// Get a new transformer object for the xsl from the factory
Transformer transformer = factory.newTransformer(xslSource);
// Transform the xml given the xsl
StreamResult result = new StreamResult(out);
transformer.transform(xmlSource, (Result)result);
// flush the PrintWriter object
out.flush();
setCondition(SUCCESS);
} // end try
catch (TransformerException te)
{
try
{
System.out.println("Tranformer Failed, TransformerException: " + te);
setCondition(FAILURE);
}
catch (TransitionConditionException tce)
{
reportException(tce, true);
}
CLEException cle =
new CLEException
(CLEException.CLE178,te.getMessage(),te);
reportException(te, true);
} // end catch TransformerException
catch (Exception e)
As you can see from the dump, it's the
Transformer transformer = factory.newTransformer(xslSource);
line that causes the error. You can also see how I've tried to include an ErrorListener to catch the error and process it. This does not cause the error listener to be invoked. We still get the dump. Note the reportConfigException method is called in the process, however that seems like it might be a red herring.
How can I get a handle on the real error (line number, template name, etc...) that is causing the error in the XSL?
Thanks.