ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Griffin" <g...@h-lounge.com>
Subject StackOverflowError on SqlMapClientBuilder.buildSqlMapClient
Date Fri, 17 Nov 2006 19:24:13 GMT
Hi!

I'm new to iBatis and am trying to implement it in some of my code that's running in a J2EE
enivronment on JBoss. Using the following code, I get a StackOverflowError:

        try {
        // neither my SqlMapConfig file nor the example one delivered with iBatis seems to
work:
         String resource = "WEB-INF/SqlMapConfig.xml";
        // the following line works:
         Reader configReader = Resources.getResourceAsReader(resource);
/*
 * I used this code to make sure the reading of the XML was working:
          StringBuffer sb = new StringBuffer();
         BufferedReader br = new BufferedReader(configReader); 

         char[] cbuf = new char[65536];

         int read_this_time = 0;
        read_this_time = br.read(cbuf,0,65536);
        sb.append(cbuf,0,read_this_time);
         System.out.println(sb.toString());
*/
        //...but this line fails: 
         SqlMapClient sqlMap = SqlMapClientBuilder.buildSqlMapClient(configReader);

         List rowList = sqlMap.queryForList("getRowList", listParams);
         data.getRequest().setAttribute("rowlist", rowList);
     } catch (IOException io) {
         throw new RuntimeException("Error: " + io, io);
     } catch (SQLException se) {
      throw new RuntimeException("Error: " + se, se);
     } catch (Exception e) {
      throw new RuntimeException("Error: " + e, e);
     }

The stack trace:

javax.servlet.ServletException: Servlet execution threw an exception
 org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)

root cause

java.lang.StackOverflowError
 java.lang.Object.hashCode(Native Method)
 java.util.Hashtable.get(Hashtable.java:336)
 gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1570)
 gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1591)
 gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1591)
 gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1591)
 gnu.xml.pipeline.ValidationConsumer$ChildrenRecognizer.patchNext(ValidationConsumer.java:1591)
...

Here's the config file that came with the iBatis I have.
(Build Date: 2006/08/16 19:50 Build Number: 638):

<?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">

<sqlMapConfig>

  <!-- Configure a built-in transaction manager.  If you're using an 
       app server, you probably want to use its transaction manager 
       and a managed datasource -->
  <transactionManager type="JDBC" commitRequired="false">
    <dataSource type="SIMPLE">
      <property name="JDBC.Driver" value="org.hsqldb.jdbcDriver"/>
      <property name="JDBC.ConnectionURL" value="jdbc:hsqldb:."/>
      <property name="JDBC.Username" value="sa"/>
      <property name="JDBC.Password" value="sa"/>
    </dataSource>
  </transactionManager>

  <!-- List the SQL Map XML files. They can be loaded from the 
       classpath, as they are here (com.domain.data...) -->
  <sqlMap resource="com/mydomain/data/Account.xml"/>
  <!-- List more here...
  <sqlMap resource="com/mydomain/data/Order.xml"/>
  <sqlMap resource="com/mydomain/data/Documents.xml"/>
  -->

</sqlMapConfig>

If you have any idea what I might be doing wrong, please let me know. It's as if the XML is
causing a never ending loop for some reason. I validated my XML against the DTD and it looked
okay. Here's my XML. I tried with and without lazy loading enabled:

<?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">

<sqlMapConfig>

<!--  <settings useStatementNamespaces="false" /> -->
 <settings lazyLoadingEnabled="false" />
    <transactionManager type="JDBC" >
        <dataSource type="JNDI">
            <property name="DataSource" value="java:comp/env/jdbc/qcsql"/>
        </dataSource>
    </transactionManager>

    <sqlMap resource="RowList.xml"/>
</sqlMapConfig>

THANKS!
Gary
Mime
View raw message