org.springframework.jdbc.IncorrectResultSetColumnCountException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Error in executing Spring Query
    via by Mary Cole,
  • the JdbcSearchableJobExecutionDao.getJobExecutions uses the SimpleJdbcTemplate queryForLong method and passes the query generated by an instance of PagingQueryProvider's generateJumpToItemQuery method. This is problematic when using the OraclePagingQueryProvider because generateJumpToItemQuery returns a resultset with two columns due to the use of Oracle's ROWNUM feature. As a result, the SingleColumnRowMapper that the SimpleJdbcTemplate uses to extract the Long blows up. The JdbcSearchableJobExecutionDao.getJobExecutions (and other paging methods) probably needs to be tweaked to stop using queryForLong and just use the first column retrieved. Alternatively, the OraclePagingQueryProvider.generateJumpToItemQuery could be mangled a bit to only return 1 column. The referenced spring forum post runs into this issue in the second to last entry, but it doesn't identify this as the root cause. Here's the stack trace: {noformat} 2010-10-07 13:39:17,016 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[Batch Servlet]] - Servlet.service() for servlet Batch Servlet threw exception org.springframework.jdbc.IncorrectResultSetColumnCountException: Incorrect column count: expected 1, actual 2 at org.springframework.jdbc.core.SingleColumnRowMapper.mapRow(SingleColumnRowMapper.java:87) at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92) at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:1) at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:445) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:463) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:471) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:476) at org.springframework.jdbc.core.JdbcTemplate.queryForLong(JdbcTemplate.java:480) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForLong(SimpleJdbcTemplate.java:127) at org.springframework.batch.admin.service.JdbcSearchableJobExecutionDao.getJobExecutions(JdbcSearchableJobExecutionDao.java:190) at org.springframework.batch.admin.service.SimpleJobService.listJobExecutions(SimpleJobService.java:220) at org.springframework.batch.admin.web.JobExecutionController.list(JobExecutionController.java:156) ...snip... {noformat}
    via by Seth Weiner,
  • the JdbcSearchableJobExecutionDao.getJobExecutions uses the SimpleJdbcTemplate queryForLong method and passes the query generated by an instance of PagingQueryProvider's generateJumpToItemQuery method. This is problematic when using the OraclePagingQueryProvider because generateJumpToItemQuery returns a resultset with two columns due to the use of Oracle's ROWNUM feature. As a result, the SingleColumnRowMapper that the SimpleJdbcTemplate uses to extract the Long blows up. The JdbcSearchableJobExecutionDao.getJobExecutions (and other paging methods) probably needs to be tweaked to stop using queryForLong and just use the first column retrieved. Alternatively, the OraclePagingQueryProvider.generateJumpToItemQuery could be mangled a bit to only return 1 column. The referenced spring forum post runs into this issue in the second to last entry, but it doesn't identify this as the root cause. Here's the stack trace: {noformat} 2010-10-07 13:39:17,016 ERROR [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/].[Batch Servlet]] - Servlet.service() for servlet Batch Servlet threw exception org.springframework.jdbc.IncorrectResultSetColumnCountException: Incorrect column count: expected 1, actual 2 at org.springframework.jdbc.core.SingleColumnRowMapper.mapRow(SingleColumnRowMapper.java:87) at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92) at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:1) at org.springframework.jdbc.core.JdbcTemplate$1QueryStatementCallback.doInStatement(JdbcTemplate.java:445) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:395) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:455) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:463) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:471) at org.springframework.jdbc.core.JdbcTemplate.queryForObject(JdbcTemplate.java:476) at org.springframework.jdbc.core.JdbcTemplate.queryForLong(JdbcTemplate.java:480) at org.springframework.jdbc.core.simple.SimpleJdbcTemplate.queryForLong(SimpleJdbcTemplate.java:127) at org.springframework.batch.admin.service.JdbcSearchableJobExecutionDao.getJobExecutions(JdbcSearchableJobExecutionDao.java:190) at org.springframework.batch.admin.service.SimpleJobService.listJobExecutions(SimpleJobService.java:220) at org.springframework.batch.admin.web.JobExecutionController.list(JobExecutionController.java:156) ...snip... {noformat}
    via by Seth Weiner,
    • org.springframework.jdbc.IncorrectResultSetColumnCountException: Incorrect column count: expected 1, actual 8 at org.springframework.jdbc.core.SingleColumnRowMapper.mapRow(SingleColumnRowMapper.java:87) at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:92) at org.springframework.jdbc.core.RowMapperResultSetExtractor.extractData(RowMapperResultSetExtractor.java:1) at org.springframework.jdbc.core.JdbcTemplate$1.doInPreparedStatement(JdbcTemplate.java:648) at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:586) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:636) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:661) at org.springframework.jdbc.core.JdbcTemplate.query(JdbcTemplate.java:701) at org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate.queryForObject(NamedParameterJdbcTemplate.java:177)

    Users with the same issue

    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,