Announcement Announcement Module
Collapse
No announcement yet.
Error when saving a StepInstance Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error when saving a StepInstance

    I am facing a blocking issue when saving a step instance/step execution.

    Here is the error stack:
    Code:
    Caused by: java.sql.SQLException: Invalid column datatype
    	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:134)
    	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:179)
    	at oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:269)
    	at oracle.jdbc.driver.OracleStatement.get_internal_type(OracleStatement.java:6541)
    	at oracle.jdbc.driver.OraclePreparedStatement.setNull(OraclePreparedStatement.java:1424)
    	at org.apache.commons.dbcp.DelegatingPreparedStatement.setNull(DelegatingPreparedStatement.java:104)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValueInternal(StatementCreatorUtils.java:154)
    	at org.springframework.jdbc.core.StatementCreatorUtils.setParameterValue(StatementCreatorUtils.java:94)
    	at org.springframework.jdbc.core.ArgPreparedStatementSetter.setValues(ArgPreparedStatementSetter.java:51)
    	at org.springframework.jdbc.core.JdbcTemplate$2.doInPreparedStatement(JdbcTemplate.java:742)
    	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:537)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:738)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:796)
    	at org.springframework.jdbc.core.JdbcTemplate.update(JdbcTemplate.java:804)
    	at org.springframework.batch.execution.repository.dao.JdbcStepDao.update(JdbcStepDao.java:623)
    	at org.springframework.batch.execution.repository.SimpleJobRepository.update(SimpleJobRepository.java:279)
            ... (AOP transaction stuff)
    	at $Proxy10.update(Unknown Source)
    	at org.springframework.batch.execution.step.simple.SimpleStepExecutor.updateStatus(SimpleStepExecutor.java:304)
    	at org.springframework.batch.execution.step.simple.SimpleStepExecutor.execute(SimpleStepExecutor.java:275)
    	at org.springframework.batch.execution.step.simple.SimpleStep.execute(AbstractStep.java:131)
    	at org.springframework.batch.execution.job.simple.SimpleJob.execute(SimpleJob.java:82)
    Note: I had to change the datatype of LAST_STEP_EXECUTION_ID from BIGINT to NUMBER, as BIGINT datatype does not exist in Oracle9.

    When exploring this issue, I noticed that in SimpleStepExecutor.updateStatus(), the stepInstance is updated before stepExecution is created and is assigned an ID, and therefore, LAST_STEP_EXECUTION_ID is set to null. Maybe the order should be reversed (first save or update step execution, then update step instance) ?

    If this cannot be achieved for some reason and we can live with a null LAST_STEP_EXECUTION_ID, JdbcStepDao must use JdbcTemplate.update(String, Object[], int[]) instead of update(String, Object[]), in order to correctly set the datatypes of the parameters. I noticed that this simple change works. Maybe the above is a JdbcTemplate bug, or a JDBC driver bug ?

  • #2
    In m5-snapshot instance tables no longer have a reference to last execution, so updating to current trunk may solve your issue (update helped in http://jira.springframework.org/browse/BATCH-360)

    Comment


    • #3
      And I found that, in m4, schema-oracle10g.sql used datatypes that not exists in Oracle. You may fix occurence of BIGINT to, for example, NUMBER(38), and run the changed script yourself

      Comment

      Working...
      X