Hello,

I am just trying to get underway with some IBatis and I am running into parse 
problems. The sqlMapConfig is straight from the PDF, supplied my own DB props.

I have a servlet that  performs the parsing of config at startup. It apparently 
gets thriough the sqlMapConfig and blows up with errors while trying to read 
the LabelValueSQL.xml.  The error does not make sense as I have an id for the 
sqlMap?

If someone could please look at this, it would make my day.

Thanks,
Scott


ERROR: INFO
 [ContainerBackgroundProcessor[StandardEngine[Catalina]]] 
(ValidatorPlugIn.java:213) - Loading validation rules file from 
'/WEB-INF/classes/com/mb/purcell/conf/validation.xml'
 INFO [http-80-Processor24] (?:?) - 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx
 INFO [http-80-Processor24] (?:?) - AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
ERROR [http-80-Processor24] (?:?) - BaseDAO static block: 
com.ibatis.common.exception.NestedRuntimeException: Error occurred.  Cause: 
com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: 
com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath 
'/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error 
parsing XML.  Cause: org.xml.sax.SAXParseException: Attribute "id" must be 
declared for element type "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: 
org.xml.sax.SAXParseException: Attribute "id" must be declared for element type 
"sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing 
XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: 
Error parsing XML.  Cause: org.xml.sax.SAXParseException: Attribute "id" must 
be declared for element type "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: 
org.xml.sax.SAXParseException: Attribute "id" must be declared for element type 
"sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: 
com.ibatis.common.exception.NestedRuntimeException: Error parsing XPath 
'/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: Error 
parsing XML.  Cause: org.xml.sax.SAXParseException: Attribute "id" must be 
declared for element type "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: 
org.xml.sax.SAXParseException: Attribute "id" must be declared for element type 
"sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error parsing 
XPath '/sqlMapConfig/sqlMap'.  Cause: com.ibatis.common.xml.NodeletException: 
Error parsing XML.  Cause: org.xml.sax.SAXParseException: Attribute "id" must 
be declared for element type "sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
Caused by: com.ibatis.common.xml.NodeletException: Error parsing XML.  Cause: 
org.xml.sax.SAXParseException: Attribute "id" must be declared for element type 
"sqlMap".
Caused by: org.xml.sax.SAXParseException: Attribute "id" must be declared for 
element type "sqlMap".
ERROR [http-80-Processor24] (ApplicationContext.java:662) - Servlet /UPIbatis 
threw load() exception
javax.servlet.ServletException: Error instantiating servlet class 
com.mb.purcell.SetupServlet
        at 
org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1034)
        at 
org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:900)
        at 
org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3823)
        at 
org.apache.catalina.core.StandardContext.start(StandardContext.java:4087)
        at 
org.apache.catalina.core.StandardContext.reload(StandardContext.java:2920)
        at 
org.apache.catalina.manager.ManagerServlet.reload(ManagerServlet.java:906)
        at 
org.apache.catalina.manager.HTMLManagerServlet.reload(HTMLManagerServlet.java:456)
        at 
org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:98)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
        at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
        at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
        at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
        at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
        at 
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:482)
        at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
        at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
        at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
        at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
        at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
        at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
        at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
        at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Unknown Source)
 INFO [http-80-Processor24] (TilesPlugin.java:238) - Tiles definition factory 
loaded for module ''.
 INFO [http-80-Processor24] (ValidatorPlugIn.java:213) - Loading validation 
rules file from '/WEB-INF/classes/com/mb/purcell/conf/validator-rules.xml'
 INFO [http-80-Processor24] (ValidatorPlugIn.java:213) - Loading validation 
rules file from '/WEB-INF/classes/com/mb/purcell/conf/validation.xml'



######################################## called at startup 
###############################################3



    static {
        try {
          log.info("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXx");
            String resource = "com/conf/sqlMapConfig.xml";
            Reader reader = Resources.getResourceAsReader(resource);
            log.info("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
            log.debug("reader = "+reader );
            sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
            log.info("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB");
            log.debug("sqlMap = "+sqlMap );
            reader.close();
        } catch (Exception ex) {
            log.error("BaseDAO static block: " + ex);
            throw new RuntimeException("Error Initializing BaseDAO :" + ex);
        }


It apparently gets thriough my sqlMapConfig.xml without any problems.
But blows up apparently when trying to use the resource that is called at 
bottom LabelValueSQL.xml


The culprit is here I bet, but I cannot figure it out
<!DOCTYPE sqlMap PUBLIC "-//iBATIS.com//DTD SQL Map 2.0//EN"
 "http://www.ibatis.com/dtd/sql-map-2.dtd";>


<sqlMap id="LabelValueSQL">

    
    <cacheModel id="label_value_cache" type="STRONG">
        <flushInterval hours="48"/>
    </cacheModel>
     
    <resultMap id="label_value_result"       class="com.mb.purcell.LabelValue">
        <result property="value"                  column="id" />
        <result property="label"                  column="name" />
    </resultMap>
    
    <statement  id="selectAllCategories"   resultMap="label_value_result" 
cacheModel="label_value_cache">
        SELECT  id, name FROM item ORDER BY  id
    </statement>
     
</sqlMap>






sqlMapConfig.xml from pdf 2.0 Ibatis
<?xml version="1.0" encoding="UTF-8" ?>

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

<!-- Always ensure to use the correct XML header as above! -->
<sqlMapConfig>
<!-- The properties (name=value) in the file specified here can be used 
placeholders in this config
file (e.g. "${driver}". The file is relative to the classpath and is completely 
optional. -->
<properties resource="com/mb/purcell/conf/database.properties" />
<!-- These settings control SqlMapClient configuration details, primarily to do 
with transaction
management. They are all optional (more detail later in this document). -->
<settings
cacheModelsEnabled="true"
enhancementEnabled="true"
lazyLoadingEnabled="true"
maxRequests="128"
maxSessions="10"
maxTransactions="5"
useStatementNamespaces="false"
/>
<!-- Type aliases allow you to use a shorter name for long fully qualified 
class names. -->
<typeAlias alias="order" type="testdomain.Order"/>
<!-- Configure a datasource to use with this SQL Map using SimpleDataSource.
Notice the use of the properties from the above resource -->
<transactionManager type="JDBC" >
<dataSource type="SIMPLE">
<property name="JDBC.Driver" value="${driver}"/>
<property name="JDBC.ConnectionURL" value="${url}"/>
<property name="JDBC.Username" value="${username}"/>
<property name="JDBC.Password" value="${password}"/>
<property name="JDBC.DefaultAutoCommit" value="true" />
<property name="Pool.MaximumActiveConnections" value="10"/>
<property name="Pool.MaximumIdleConnections" value="5"/>
<property name="Pool.MaximumCheckoutTime" value="120000"/>
<property name="Pool.TimeToWait" value="500"/>
<property name="Pool.PingQuery" value="select 1 from ACCOUNT"/>
<property name="Pool.PingEnabled" value="false"/>
<property name="Pool.PingConnectionsOlderThan" value="1"/>
<property name="Pool.PingConnectionsNotUsedFor" value="1"/>
</dataSource>
</transactionManager>
<!-- Identify all SQL Map XML files to be loaded by this SQL map. Notice the 
paths
are relative to the classpath. For now, we only have one... -->

    <sqlMap resource="com/mb/purcell/sql/LabelValueSQL.xml" />

</sqlMapConfig>

Reply via email to