Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting Error while validating xml against schema using Weblogic serve

Status
Not open for further replies.

dparikh72

Programmer
Oct 14, 2005
5
0
0
US
Hello,

I am in a serious problem, i have a class that validates the XML against the schema.

When i run it on tomcat it gives no errors and it validates and give proper messages but as soon as i run the same on weblog server it gives errors and not validating it and give errors even though the XML is 100 % valid by XMLSPY.

my code spinet is as under :

public boolean performValidation(String filePath, String schemaLocation) throws SAXException, ParserConfigurationException, SAXNotRecognizedException, IOException {
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(true);
spf.setFeature(" true);
spf.setFeature(" true);
spf.setFeature(" true);
spf.setFeature(" true);

javax.xml.parsers.SAXParser sp = spf.newSAXParser();
sp.setProperty(" "sp.setProperty(" schemaLocation);

org.xml.sax.XMLReader xmlReader;
//Create XMLReader
xmlReader = sp.getXMLReader();
//xmlReader.setEntityResolver(new SchemaLoader());

ContentHandler cHandler = new XMLHandler();
XMLHandler eHandler = new XMLHandler();

xmlReader.setContentHandler(cHandler);
xmlReader.setErrorHandler(eHandler);

xmlReader.parse(filePath);
DfLogger.debug(this, "# of schema validation errors = " + eHandler.getErrorCount(), null, null);
return eHandler.getValid();
}

errors occurs at (xmlReader.parse(filePath)) ... as weblogic calls it own class ..

weblogic goes into....

at weblogic.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:232)
at weblogic.apache.xerces.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:173)
at weblogic.apache.xerces.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:371)
at weblogic.apache.xerces.impl.xs.XSConstraints.reportSchemaError(XSConstraints.java:316)
at weblogic.apache.xerces.impl.xs.XSConstraints.fullSchemaChecking(XSConstraints.java:446)
at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.handleEndElement(XMLSchemaValidator.java:2154)
at weblogic.apache.xerces.impl.xs.XMLSchemaValidator.endElement(XMLSchemaValidator.java:706)
at weblogic.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceBinder.java:898)
at weblogic.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.java:644)
at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1008)
at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1469)
at weblogic.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:329)
at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:525)
at weblogic.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:581)
at weblogic.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
at weblogic.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1175)
at weblogic.xml.jaxp.WebLogicXMLReader.parse(WebLogicXMLReader.java:135)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:152)
at weblogic.xml.jaxp.RegistryXMLReader.parse(RegistryXMLReader.java:164)

why its going in his own XMLReader and not using my specified jar.. ??

I created a endorsed directory in weblogic and put all the required jars into it but still its not picking up my jars.


thanks
 
Check the order of that jars in the WL server. Be careful with weblogic.jar, it has its own implementation of xml.

Cheers,
Dian
 
thanks,

can u be more specific, i am not that used to weblogic.

 
The WL server has a classpath that determines the order that the jar files are loaded into the JVM.

If you have weblogic.jar first, then the XML will be parsed using WL parser, that may differ from the other you have.

Cheers,
Dian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top