Results 1 to 10 of 10

Thread: Football Sample not working

  1. #1
    Join Date
    Dec 2007
    Posts
    9

    Default Football Sample not working

    Hi,

    I am trying to execute the FootballJobFunctionalTests through Junit. The database used is hsqldb. I get the following error:

    org.springframework.dao.DataIntegrityViolationExce ption: PreparedStatementCallback; SQL [UPDATE BATCH_STEP set STATUS = ?, RESTART_DATA = ? where ID = ?]; Value too long in statement [UPDATE BATCH_STEP set STATUS = ?, RESTART_DATA = ? where ID = ?]; nested exception is java.sql.SQLException: Value too long in statement [UPDATE BATCH_STEP set STATUS = ?, RESTART_DATA = ? where ID = ?]
    at org.springframework.jdbc.support.SQLStateSQLExcept ionTranslator.translate(SQLStateSQLExceptionTransl ator.java:111)
    at org.springframework.jdbc.support.SQLErrorCodeSQLEx ceptionTranslator.translate(SQLErrorCodeSQLExcepti onTranslator.java:322)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:582)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:767)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:825)
    at org.springframework.jdbc.core.JdbcTemplate.update( JdbcTemplate.java:833)
    at org.springframework.batch.execution.repository.dao .SqlStepDao.update(SqlStepDao.java:256)
    at org.springframework.batch.execution.repository.Sim pleJobRepository.update(SimpleJobRepository.java:2 03)
    at sun.reflect.GeneratedMethodAccessor6.invoke(Unknow n Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:301)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:182)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :149)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:106)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.interceptor.ExposeInvocati onInterceptor.invoke(ExposeInvocationInterceptor.j ava:89)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :171)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:204)
    at $Proxy0.update(Unknown Source)
    at org.springframework.batch.execution.step.simple.Si mpleStepExecutor.updateStatus(SimpleStepExecutor.j ava:309)
    at org.springframework.batch.execution.step.simple.Si mpleStepExecutor.process(SimpleStepExecutor.java:2 73)
    at org.springframework.batch.execution.job.DefaultJob Executor.run(DefaultJobExecutor.java:97)
    at org.springframework.batch.execution.launch.SimpleJ obExecutorFacade.start(SimpleJobExecutorFacade.jav a:199)
    at org.springframework.batch.execution.launch.SimpleJ obLauncher.runInternal(SimpleJobLauncher.java:248)
    at org.springframework.batch.execution.launch.SimpleJ obLauncher$1.run(SimpleJobLauncher.java:292)
    at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:49)
    at org.springframework.batch.execution.launch.SimpleJ obLauncher.run(SimpleJobLauncher.java:280)
    at org.springframework.batch.sample.AbstractBatchLaun cherTests.testLaunchJob(AbstractBatchLauncherTests .java:84)
    at org.springframework.batch.sample.AbstractValidatin gBatchLauncherTests.testLaunchJob(AbstractValidati ngBatchLauncherTests.java:34)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:164 )
    at junit.framework.TestCase.runBare(TestCase.java:130 )
    at org.springframework.test.ConditionalTestCase.runBa re(ConditionalTestCase.java:76)
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:120)
    at junit.framework.TestSuite.runTest(TestSuite.java:2 30)
    at junit.framework.TestSuite.run(TestSuite.java:225)
    at org.eclipse.jdt.internal.junit.runner.junit3.JUnit 3TestReference.run(JUnit3TestReference.java:128)
    at org.eclipse.jdt.internal.junit.runner.TestExecutio n.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)
    Caused by: java.sql.SQLException: Value too long in statement [UPDATE BATCH_STEP set STATUS = ?, RESTART_DATA = ? where ID = ?]
    at org.hsqldb.jdbc.Util.throwError(Unknown Source)
    at org.hsqldb.jdbc.jdbcPreparedStatement.executeUpdat e(Unknown Source)
    at org.springframework.jdbc.core.JdbcTemplate$2.doInP reparedStatement(JdbcTemplate.java:773)
    at org.springframework.jdbc.core.JdbcTemplate.execute (JdbcTemplate.java:566)
    ... 46 more




    I tried the same test with oracle10g as database and got the error as shown in football_Error.jpg

    Let me know the solution in both the cases.
    Attached Images Attached Images

  2. #2

    Default

    I got the same exception when I tried running the job. I even got some failure related to optimistic locking once (the FootballJobFunctionalTests currently points run the parallelJob.xml, not the original footballJob.xml)

  3. #3

    Default

    Just for record, here is the stack trace of the optimistic locking exception:

    Code:
    org.springframework.dao.OptimisticLockingFailureException: The staging record with ID=0 was updated concurrently when trying to mark as complete.
        at org.springframework.batch.sample.item.provider.StagingItemReader.read(StagingItemReader.java:147)
        at org.springframework.batch.sample.item.provider.StagingItemReader$$FastClassByCGLIB$$d174d26.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
        at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:696)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
        at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
        at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:631)
        at org.springframework.batch.sample.item.provider.StagingItemReader$$EnhancerByCGLIB$$fe564613.read(<generated>)
        at org.springframework.batch.execution.tasklet.ItemOrientedTasklet.execute(ItemOrientedTasklet.java:147)
        at org.springframework.batch.execution.step.simple.SimpleStepExecutor.doTaskletProcessing(SimpleStepExecutor.java:380)
        at org.springframework.batch.execution.step.simple.SimpleStepExecutor$4.doInIteration(SimpleStepExecutor.java:349)
        at org.springframework.batch.repeat.support.RepeatTemplate.getNextResult(RepeatTemplate.java:324)
        at org.springframework.batch.repeat.support.RepeatTemplate.executeInternal(RepeatTemplate.java:201)
        at org.springframework.batch.repeat.support.RepeatTemplate.iterate(RepeatTemplate.java:131)
        at org.springframework.batch.execution.step.simple.SimpleStepExecutor.processChunk(SimpleStepExecutor.java:335)
        at org.springframework.batch.execution.step.simple.SimpleStepExecutor$3.doInTransaction(SimpleStepExecutor.java:222)
        at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
        at org.springframework.batch.execution.step.simple.SimpleStepExecutor$1.doInIteration(SimpleStepExecutor.java:211)
        at org.springframework.batch.repeat.support.TaskExecutorRepeatTemplate$ExecutingRunnable.run(TaskExecutorRepeatTemplate.java:227)
        at java.lang.Thread.run(Thread.java:619)

  4. #4
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    There are two issues in this post now. The DataIntegrityViolation is caused by the RESTART_DATA column in BATCH_STEP_EXECUTION being too short. Beef it up to VARCHAR(1000) and it works for me. I'm not sure why this didn't break before.

    The OpimisticLockingException can be avoided by switching the configuration back to the oirginal "footballJob.xml". The parallel configuration fails because of a concurrency problem in the StagingItemProvider. It will be fixed in tonight's snapshot build (or in SVN) if you want to try it out.

  5. #5
    Join Date
    Dec 2007
    Posts
    9

    Default Re:

    Thanks Dave,
    It worked for me also. I had changed it to varchar(500).

  6. #6
    Join Date
    Mar 2008
    Posts
    17

    Default Football Sample Issue

    I have faced the same issue. but, i am new to the Spring Batch so please help me, where can i find the BATCH_STEP_EXECUTION and RESTART_DATA column.

    Thanks in advance


    Srinivas.R
    Srinivas.R

  7. #7

    Default

    The issue is very old and database schema has changed significantly since then. EXECUTION_CONTEXT table is now used to store restart data. Unless you are using a very outdated framework version, you shouldn't really be facing "the same issue" - football sample in RC1 runs fine as far as I'm aware.

  8. #8
    Join Date
    Mar 2008
    Posts
    17

    Thumbs up Football Sample Issue

    Thanks for your reply. Its working find with M5 snapshot.


    Srinivas.R
    Srinivas.R

  9. #9
    Join Date
    Oct 2009
    Location
    Milano
    Posts
    49

    Default

    FootballJobFunctionalTests still does not work.

    "out of the box" if i run the test, it won't work saying it cannot find simple-job-launcher-context.xml

    i had to change this line
    Code:
    @ContextConfiguration(locations = { "/simple-job-launcher-context.xml", "/jobs/footballJob.xml", "/job-runner-context.xml" })
    into
    Code:
    @ContextConfiguration(locations = { "classpath*:simple-job-launcher-context.xml", "classpath*:jobs/footballJob.xml", "classpath*:job-runner-context.xml" })
    but now it cannot find jobLauncherTestUtils

    this bean appears on JobStepFunctionalTests-context.xml but i guess for some reasons it is not imported.

    any idea on how to fix this?
    2+2=5

  10. #10
    Join Date
    Jun 2005
    Posts
    4,230

    Default

    jobLauncherTestUtils is defined in job-runner-context.xml. I suggest you take a look at the way your classpath is configured - all the files are there in spring-batch-samples.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •