• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

SAXParseException: schema_reference.4: Failed to read schema document

 
rajesh chalavadi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am running into following SAXParseException when I am trying to create a Schema from a URL with the following code.

SchemaFactory sf = ShemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
sf.newSchema(url);

I have verified that schema document exists at the location of URL. Initially I thought this is because of space chars in the URL. But even after encoding the URL, I am running into the this exception.

Could any one please let me know the cause for this exception? Any help in this regard is highly appreciated.

Caused by: org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document
'code-source:/C:/ADE/rchalava_vw3/oracle%20spaces/mds/lib/mdsrt.jar!/oracle/mds/xsd/mdsConfig.xsd',
because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <xsd:schema>.
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.XMLErrorReporter.reportError(XMLErrorReporter.java:316)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.reportSchemaError(XSDHandler.java:2245)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.getSchema(XSDHandler.java:1590)
at com.sun.org.apache.xerces.internal.impl.xs.traversers.XSDHandler.parseSchema(XSDHandler.java:438)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadSchema(XMLSchemaLoader.java:556)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaLoader.loadGrammar(XMLSchemaLoader.java:523)
at com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl.newSchema(SchemaFactoryImpl.java:206)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:489)
at javax.xml.validation.SchemaFactory.newSchema(SchemaFactory.java:521)
 
Paul Clapham
Sheriff
Pie
Posts: 20978
31
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
code-source:/C:/ADE/rchalava_vw3/oracle%20spaces/mds/lib/mdsrt.jar!/oracle/mds/xsd/mdsConfig.xsd

That's a strange URL. I've never seen the "code-source" protocol before. I suppose you don't have anything supporting that protocol?
 
rajesh chalavadi
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
'code-source' URL is specific to ORACLE Application server.

Please find more details in http://static.springframework.org/spring/docs/2.0.x/api/org/springframework/util/ResourceUtils.html

about various protocols of websphere, weblogic, Oracle App server etc.
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13058
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If this was my problem I would try to parse the schema document using SAX in order to use the better error reporting you can get out of an SAXParseException - namely the line number and column number triggering the fault (if the problem is actually in the document.)

If the problem is really in locating the document in the first place, some sort of IOException will probably occur.

The error message you are getting now is not much help.

Bill
 
dhaval.shah
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi.. even i am getting the same kind of error...

i have implemented the code in similar manner as specified in the site Cinnamon Service

i am using with spring and haave deployed the service using cinnamon.





any help with this will be appreciated.
thanks.
 
Pragya Patnaik
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Same with me even...
getting the same error. verified using external application, it is working fine but by using Schema factory getting error:Failed to read schema..

Any more suggestions for this??
 
Mansoor Shaikh
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Even I am facing the same issue. Was anyone able to resolve it, if yes, can you please post the solution. It is working in eclipse but not from command line.
I am using the below command line, I have ensured that all files and version in the maven POM files are correct and they exists.

<code>
java -cp jarfilename fullyqualityclassname
</code>

Thanks,
Mansoor
www.linkedin.com/in/mansoorshaikh
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic