You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Dominic Edwards <do...@hotmail.com> on 2008/02/01 16:06:53 UTC

FW: Ibatis xml problem - Document root element "sqlmapconfig", must match DOCTYPE root "sqlMap".





Hi,
 
I'm very new to iBATIS and am just tring to put together a very simple iBATIS application. Currently the application fails on the first call to an iBATIS procedure. I'm using :
 
MyEclipse 6.0.1
iBATIS 2.3.0
J2EE 1.4
Tomcat 6.0
 
There seems to be a problem with the xml files which I am really stumped on. I have researched the issue online and found various references to similar cases but no CLEAR solutions have been posted. I have tried updating the url of the validation dtd files, adding the doctype tag of the map.xml file to the sql config file, even changing the utf type from 8 to 16 and nothing seems to work.
 
I am NOT using Spring or any other framework at this stage - just a class taken from the iBATIS jpetstore demo, mapping to a local mysql db table from the same project. In theory my set up could not be simpler, it's completely stripped down (am I missing something !?) , although my connection is firewalled which is my only idea as to the problem. Cheers.
 
STACK TRACE:
 
01-Feb-2008 13:50:38 org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet jsp threw exception
org.xml.sax.SAXParseException: Document root element "sqlmapconfig", must match DOCTYPE root "sqlMap".
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$ContentDispatcher.scanRootElementHook(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(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:189)
at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:59)
at com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigParser.java:106)
at com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientBuilder.java:90)
at com.ibatis.jpetstore.sql.QueryDatabase.getAccount(QueryDatabase.java:23)
at org.apache.jsp.index_jsp._jspService(index_jsp.java:64)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:584)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
at java.lang.Thread.run(Unknown Source)
01-Feb-2008 13:51:13 org.apache.catalina.startup.HostConfig checkResourcesINFO: Reloading context [/ibatis] 
CONFIG FILE :
 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMapConfig
PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlmapconfig>

<transactionmanager type="JDBC">

<datasource type="SIMPLE">

<property name="JDBC.Driver" value="com.mysql.jdbc.Driver" />
<property name="JDBC.ConnectionURL"
value="jdbc:mysql://localhost/jpetstore" />
<property name="JDBC.Username" value="jpetstoreusr" />
<property name="JDBC.Password" value="parrot" />

</datasource>

</transactionmanager>

<sqlmap resource="com/ibatis/jpetstore/entities/maps/Account.xml" />

</sqlmapconfig>
 
MAP FILE:
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-2.dtd"> 
<sqlmap namespace="Account"> 

<typealias alias="account" type="com.ibatis.jpetstore.entities.Account"/> 

<resultmap id="accounts" class="account"> 
<result property="userID" column="userid"/> 
<result property="email" column="email"/> 
<result property="firstName" column="firstname"/> 
<result property="lastName" column="lastname"/> 
</resultmap> 

<select id="getAccount" resultClass="accounts" parameterClass="java.lang.Integer"> 
SELECT 
userid, email, firstname, lastname 
FROM jpetstore.account 
where 
userid = #value# 
</select> 

</sqlmap> 
 
Thanks for your help on this one !!
 
 
Dom Edwards
 

Sounds like? How many syllables? Guess and win prizes with Search Charades! 
_________________________________________________________________
Get Hotmail on your mobile, text MSN to 63463!
http://mobile.uk.msn.com/pc/mail.aspx

RE: Ibatis xml problem - Document root element "sqlmapconfig", must match DOCTYPE root "sqlMap".

Posted by Meindert <me...@pastelebusiness.com>.
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMapConfig

PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

 

Must be

<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE sqlMapConfig PUBLIC "-//iBATIS.com//DTD SQL Map Config 2.0//EN"
"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

 

  _____  

From: Dominic Edwards [mailto:dominicedwards@hotmail.com] 
Sent: Friday, February 01, 2008 5:07 PM
To: user-java@ibatis.apache.org
Subject: FW: Ibatis xml problem - Document root element "sqlmapconfig", must
match DOCTYPE root "sqlMap".

 

 

Hi,

 

I'm very new to iBATIS and am just tring to put together a very simple
iBATIS application. Currently the application fails on the first call to an
iBATIS procedure. I'm using :

 

MyEclipse 6.0.1

iBATIS 2.3.0

J2EE 1.4

Tomcat 6.0

 

There seems to be a problem with the xml files which I am really stumped on.
I have researched the issue online and found various references to similar
cases but no CLEAR solutions have been posted. I have tried updating the url
of the validation dtd files, adding the doctype tag of the map.xml file to
the sql config file, even changing the utf type from 8 to 16 and nothing
seems to work.

 

I am NOT using Spring or any other framework at this stage - just a class
taken from the iBATIS jpetstore demo, mapping to a local mysql db table from
the same project. In theory my set up could not be simpler, it's completely
stripped down (am I missing something !?) , although my connection is
firewalled which is my only idea as to the problem. Cheers.

 

STACK TRACE:

 

01-Feb-2008 13:50:38 org.apache.catalina.core.StandardWrapperValve invoke

SEVERE: Servlet.service() for servlet jsp threw exception

org.xml.sax.SAXParseException: Document root element "sqlmapconfig", must
match DOCTYPE root "sqlMap".

at
com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseEx
ception(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.rootElementSpeci
fied(Unknown Source)

at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartEleme
nt(Unknown Source)

at
com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(Unk
nown Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanS
tartElement(Unknown Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDispat
cher.scanRootElementHook(Unknown Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$Fragm
entContentDispatcher.dispatch(Unknown Source)

at
com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanD
ocument(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:189)

at com.ibatis.common.xml.NodeletParser.parse(NodeletParser.java:59)

at
com.ibatis.sqlmap.engine.builder.xml.SqlMapConfigParser.parse(SqlMapConfigPa
rser.java:106)

at
com.ibatis.sqlmap.client.SqlMapClientBuilder.buildSqlMapClient(SqlMapClientB
uilder.java:90)

at com.ibatis.jpetstore.sql.QueryDatabase.getAccount(QueryDatabase.java:23)

at org.apache.jsp.index_jsp._jspService(index_jsp.java:64)

at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
93)

at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)

at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:290)

at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:206)

at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:233)

at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:175)

at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128
)

at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102
)

at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:109)

at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:263)

at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)

at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http
11Protocol.java:584)

at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)

at java.lang.Thread.run(Unknown Source)

01-Feb-2008 13:51:13 org.apache.catalina.startup.HostConfig checkResources

INFO: Reloading context [/ibatis]
 

CONFIG FILE :

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMapConfig

PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-config-2.dtd">

<sqlmapconfig>

<transactionmanager type="JDBC">

<datasource type="SIMPLE">

<property name="JDBC.Driver" value="com.mysql.jdbc.Driver" />

<property name="JDBC.ConnectionURL"

value="jdbc:mysql://localhost/jpetstore" />

<property name="JDBC.Username" value="jpetstoreusr" />

<property name="JDBC.Password" value="parrot" />

</datasource>

</transactionmanager>

<sqlmap resource="com/ibatis/jpetstore/entities/maps/Account.xml" />

</sqlmapconfig>

 

MAP FILE:

 

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"

"http://ibatis.apache.org/dtd/sql-map-2.dtd"> 

<sqlmap namespace="Account"> 

<typealias alias="account" type="com.ibatis.jpetstore.entities.Account"/> 

<resultmap id="accounts" class="account"> 

<result property="userID" column="userid"/> 

<result property="email" column="email"/> 

<result property="firstName" column="firstname"/> 

<result property="lastName" column="lastname"/> 

</resultmap> 

<select id="getAccount" resultClass="accounts"
parameterClass="java.lang.Integer"> 

SELECT 

userid, email, firstname, lastname 

FROM jpetstore.account 

where 

userid = #value# 

</select> 

</sqlmap> 

 

Thanks for your help on this one !!

 

 

Dom Edwards

 

 


  _____  


Sounds like? How many syllables? Guess and win prizes with
<http://www.searchcharades.com/>  Search Charades! 

 

  _____  

Think you know your TV, music and film? Try Search Charades!
<https://www.searchcharades.com>