aspose file tools*
The moose likes Object Relational Mapping and the fly likes IBatis error: Unable to proceed because of parse error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "IBatis error: Unable to proceed because of parse error" Watch "IBatis error: Unable to proceed because of parse error" New topic
Author

IBatis error: Unable to proceed because of parse error

Vivek Hingorani
Ranch Hand

Joined: Jul 08, 2011
Posts: 38
java.lang.RuntimeException: Error occurred. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig".
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:89)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:63)
at IBatisInsert.main(IBatisInsert.java:17)
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig".
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:86)
... 2 more
Caused by: java.lang.RuntimeException: Error parsing XPath '/sqlMapConfig/sqlMap'. Cause: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig".
at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:123)
at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:84)
at com.ibatis.common.xml.NodeletParser.process(NodeletParser.java:102)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:72)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:51)
... 3 more
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML. Cause: org.xml.sax.SAXParseException: Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig".
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:53)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapParser.parse(SqlMapParser.java:51)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser$11.process(SqlMapConfigParser.java:410)
at com.ibatis.common.xml.NodeletParser.processNodelet(NodeletParser.java:121)
... 7 more
Caused by: org.xml.sax.SAXParseException: Document root element "sqlMap", must match DOCTYPE root "sqlMapConfig".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(Unknown Source)
at com.ibatis.common.xml.NodeletParser.createDocument(NodeletParser.java:157)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:50)
... 10 more
I was just trying to learn iBatis and wrote a very simple program to insert records into the database..
This is the entry at top of my SqlConfig.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMapConfig
PUBLIC "-//ibatis.apache.org//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

I am unable to solve the parse error.. Please help!!!
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1676
    
    7

Well that stack trace is a nice start, but it would also be useful if you told us the version of ibatis you are using as well as posting the configuration file that was the cause of the exception.

Looking at the exception it appears in your config file you have the document root defined to be sqlMap and it is expecting it to be sqlMapConfig.


[How To Ask Questions][Read before you PM me]
Vivek Hingorani
Ranch Hand

Joined: Jul 08, 2011
Posts: 38
the doctype mentioned is <!DOCTYPE sqlMapConfig
I would update the version in some time.. I guess it was 2.6.x.x
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1676
    
    7

Show us the whole config file
Vivek Hingorani
Ranch Hand

Joined: Jul 08, 2011
Posts: 38
Please find the sqlMapConfig.xml


and Student.xml as well



Vivek Hingorani
Ranch Hand

Joined: Jul 08, 2011
Posts: 38
using ibatis-2.3.0.677.jar
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1676
    
    7

Next time please UseCodeTags. I have added them to your previous post for you this time so you can see how much easier it is to read.

If this is a new project consider upgrading to MyBatis. IBatis has been retired and is no longer supported.

That said your problem is you are using the wrong DTD on your sql map (your config is correct). It should be like below.


Vivek Hingorani
Ranch Hand

Joined: Jul 08, 2011
Posts: 38
Still its not working.. I am unable to resolve the error.. its getting really frustating now..
see the changed xml.. I can only see the change as using sqlMap instead of sqlMapConfig
Bill Gorder
Bartender

Joined: Mar 07, 2010
Posts: 1676
    
    7

Are those the only 2 ibatis xml files in your application? There should only be one config XML and it should use this dtd



All of the mapping files (including others you may have that you did not list) should use the one below:


Make sure that your new XML files are actually getting deployed or built into the JAR/WAR maybe the changes are not being reflected in what you are executing. Are you getting the EXACT same exception? Please post it.
Vivek Hingorani
Ranch Hand

Joined: Jul 08, 2011
Posts: 38
I changed the jar to mybatis.. secondly changed the config files and den ran the program and it worked... Thanks for the help anyways... Will keep posting further queries...
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: IBatis error: Unable to proceed because of parse error