Announcement Announcement Module
Collapse
No announcement yet.
java.lang.Error: SQLWarning chain holds value that is not a SQLWarning Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.Error: SQLWarning chain holds value that is not a SQLWarning

    Hi, in my spring batch program ( v1.1.3 ), i suddenly keep getting that error

    This problem did not appear when i configure my log4j.logger.org.springframework to ERROR. This is the snippet of my configuration ( very straightforward, reading from file and save to db by calling a DAO )

    PHP Code:
        <bean id="helloStep"
            
    class="org.springframework.batch.core.step.item.SimpleStepFactoryBean">
            <
    property name="transactionManager" ref="transactionManager" />
            <
    property name="jobRepository" ref="dbJobRepository" />
            <
    property name="itemReader" ref="reader" />
            <
    property name="itemWriter" ref="itemWriter" />
            <
    property name="commitInterval" value="100" />
        </
    bean>    

        <
    bean id="reader" class="org.springframework.batch.item.file.FlatFileItemReader">
            <
    property name="resource" ref="customerNegativeInputFile" />
            <
    property name="firstLineIsHeader" value="true" />
            <
    property name="lineTokenizer" ref="customerNegativeCompositeFixedLengthTokenizer" />
            <
    property name="fieldSetMapper">
                <
    bean class="testagain.CustomerNegativeMapper" >
                    <
    property name="dateFormat" value="yyyyMMdd hhmmssSSS" />
                </
    bean>
            </
    property>
        </
    bean>
        
        <
    bean id="customerNegativeCompositeFixedLengthTokenizer" class="testagain.CompositeFixedLengthTokenizer">
            <
    property name="fixedLengthTokenizer" ref="customerNegativeFixedLengthTokenizer" />
            <
    property name="footerRecordLength" value="19" />
        </
    bean>
        
        <
    bean id="customerNegativeFixedLengthTokenizer"
            
    class="org.springframework.batch.item.file.transform.FixedLengthTokenizer">
            <
    property name="names"
                
    value="Record Indicator, Customer Name, New IC Number, Old IC Number, Card Number 1, Card Issuer 1, Card Number 2, Card Issuer 2, Reason Listed, Date Added, Add User, Last Maint Date, Last Maint User, Last Maint Time" />
            <
    property name="columns"
                
    value="1-1,2-31,32-43,44-55,56-71,72-91,92-107,108-127,128-287,288-295,296-307,308-315,316-327,328-335" />
        </
    bean>
        
        <
    bean id="itemWriter" class="testagain.LogWriter"> <property
            name
    ="genericDAO" ref="genericDAO"/> 
        </
    bean
    when i configure my logging to debug then i got :


    PHP Code:
    15:54:08 DEBUG [SessionFactoryUtilsClosing Hibernate Session
    Exception in thread 
    "main" java.lang.RuntimeExceptionjava.lang.ErrorSQLWarning chain holds value that is not a SQLWarning
        at org
    .springframework.batch.core.launch.support.SimpleJobLauncher$1.rethrow(SimpleJobLauncher.java:99)
        
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:91)
        
    at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
        
    at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81)
        
    at wew.StartBatch.main(StartBatch.java:29)
    Caused byjava.lang.ErrorSQLWarning chain holds value that is not a SQLWarning
        at java
    .sql.SQLWarning.getNextWarning(SQLWarning.java:96)
        
    at org.springframework.jdbc.core.JdbcTemplate.handleWarnings(JdbcTemplate.java:1222)
        
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:592)
        
    at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:619)
        
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.updateExecutionAttribute(JdbcExecutionContextDao.java:193)
        
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.saveOrUpdateExecutionContext(JdbcExecutionContextDao.java:130)
        
    at org.springframework.batch.core.repository.dao.JdbcExecutionContextDao.saveOrUpdateExecutionContext(JdbcExecutionContextDao.java:109)
        
    at org.springframework.batch.core.repository.dao.JdbcStepExecutionDao.saveOrUpdateExecutionContext(JdbcStepExecutionDao.java:142)
        
    at org.springframework.batch.core.repository.support.SimpleJobRepository.saveOrUpdateExecutionContext(SimpleJobRepository.java:254)
        
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        
    at java.lang.reflect.Method.invoke(Method.java:585)
        
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
        
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
        
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        
    at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
        
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
        
    at $Proxy0.saveOrUpdateExecutionContext(Unknown Source)
        
    at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:201)
        
    at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:100)
        
    at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86)
        ... 
    3 more 


    I try to debug to the source code level and this problem is thrown by the method updateExecutionAttribute as well as insertExecutionAttribute in this line:

    PHP Code:
    Integer affectedRows = (Integer) getJdbcTemplate().execute(getQuery(UPDATE_STEP_EXECUTION_CONTEXT), callback); 
    From debugging, i find that this callback code is probably the culprit
    PHP Code:
    else if (type == AttributeType.LONG) {
                        
    ps.setString(1AttributeType.LONG.toString());
                        
    ps.setString(2null);
                        
    ps.setDouble(30.0);
                        
    ps.setLong(4, ((Longvalue).longValue());
                        
    lobCreator.setBlobAsBytes(ps5null);
                    } 

    I browse to http://jira.springframework.org/browse/BATCH-820 for the Lob issue and i decided to change the code
    lobCreator.setBlobAsBytes(ps, 5, null); to setBlob(lobCreator, ps, 5, value); and it wont throw that error again.


    Furthermore i try to debug the root cause of exception and in this SQLWarning class

    PHP Code:
    public SQLWarning getNextWarning() {
        try {
            return ((
    SQLWarning)getNextException());
        } catch (
    ClassCastException ex) {
            
    // The chained value isn't a SQLWarning.
            // This is a programming error by whoever added it to
            // the SQLWarning chain.  We throw a Java "Error".
            
    throw new Error("SQLWarning chain holds value that is not a SQLWarning");
        }
        } 
    the getNextException() is actually "com.ibm.db2.jcc.c.SqlException: DB2 SQL error: SQLCODE: -301, SQLSTATE: 07006, SQLERRMC: 8"

    I created the schema from the provided scripts though

    can anybody pinpoint what am i doing wrong here ?

    thanks

    ballistic_realm

  • #2
    What database version and jdbc driver are you using?

    Comment


    • #3
      Hi

      My db is db2 v9.1.0.356. My jdbc driver is com.ibm.db2.jcc.DB2Driver version IBM DB2 JDBC Universal Driver Architecture 3.1.57


      One thing to note here is that is does not always happen. I mean i have a few batch jobs. Some of then will have this error and some won't. When I get this error, i can always prevent is by setting the debug level ( or just use the mapJobRepository). Still trying to find out what's actually the difference in my batch programs but in general, all is similar.


      thanks

      ballistic_realm

      Comment


      • #4
        Originally posted by ballistic_realm View Post
        Hi

        My db is db2 v9.1.0.356. My jdbc driver is com.ibm.db2.jcc.DB2Driver version IBM DB2 JDBC Universal Driver Architecture 3.1.57


        One thing to note here is that is does not always happen. I mean i have a few batch jobs. Some of then will have this error and some won't. When I get this error, i can always prevent is by setting the debug level ( or just use the mapJobRepository). Still trying to find out what's actually the difference in my batch programs but in general, all is similar.


        thanks

        ballistic_realm

        I've noticed the same - ballistic - do yoiu have more details on your environment?
        Running WAS 6.1.0.21 here.
        DB 8.2

        Is an issue registred so this can be tracked more orderly?

        Comment


        • #5
          Jira

          I added this issue to track it: http://jira.springframework.org/browse/BATCH-1029

          Comment


          • #6
            Hi david

            i am running weblogic 9.2 though

            thanks for the jira

            regards

            ballistic_realm

            Comment

            Working...
            X