ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From reub...@sonic.net
Subject Lazy loader throwing NPE
Date Tue, 18 Oct 2005 20:20:09 GMT
If I turn lazy loading on, it is throwing an NPE from one specific sqlmaps
query. The other queries & inserts work correctly.

When I posted this problem last week, I misdirected attention by
theorizing that this had something to do with the fact that I'm using
spring transactions; I'm pretty sure it doesn't:

The stacktrace is:

com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:776)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:137)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:115)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:860)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:617)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:101)
at
com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:7Cool
at
com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult(ResultLoader.java:72)
at
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader.loadObject(LazyResultLoader.java:9Cool
at
com.ibatis.sqlmap.engine.mapping.result.loader.LazyResultLoader.invoke(LazyResultLoader.java:81)
at $Proxy1.toArray(Unknown Source)

At this point in the code, it is doing:

txManager.end(session);

txManager is, obviously, a TransactionManager; it is only built,
apparently, from the constructor of SqlMapConfigParser.


To initialize, I do, in the constructor of my class which extends
SqlMapClientDaoSupport:

        super.setDataSource(ds);
        SqlMapClient smc = SqlMapClientBuilder.buildSqlMapClient(new
InputStreamReader(         
Config.getClasspathResource("classpath:.../ibatisSQLMapsConfig.xml").getInputStream()));
        super.setSqlMapClient(smc);


SqlMapClientBuilder.buildSqlMapClient(...)

calls:

  return new SqlMapConfigParser().parse(reader);

The constructor with no arguments is as follows:

  public SqlMapConfigParser() {
    this(null, null);
  }

However, line 272 of SqlMapConfigParser is never reached:

  vars.client.getDelegate().setTxManager(txManager);

In fact, the process(Node node) method that it is wrapped in is never
invoked; I don't have the source for NodeletParser handy, so I can't see
why it is failing. I can look into this further if this problem is not
reproducible by the devs.

Am I missing something from my setup, or this a bug in Ibatis?

Thanks




Mime
View raw message