Announcement Announcement Module
Collapse
No announcement yet.
NullPointerException when running multi-step job from WebSphere 6 Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • NullPointerException when running multi-step job from WebSphere 6

    I have a Spring Batch (2.1.6) application that reads data from XML files and persists them into database. The application works fine as a standalone application started by UNIX scripts or Windows batch. Now the client want to run the jobs from WebSphere 6 and scheduled through Quartz. That's where we got problem. For the job that has a single step, it works well. But for the jobs with multiple steps, we got NullPointerException. It seems that this exception may occur at any steps and it is not consistent. That worries me.

    The relevant logging info and the Spring configure file is listed. Please help.

    Thanks

    logs:

    [15/03/11 14:40:05:812 EDT] 00000015 SystemOut O Starting executing job [bisVerificationJob]
    [15/03/11 14:40:05:890 EDT] 00000015 SystemOut O Starting to validate XML files...
    [15/03/11 14:40:05:890 EDT] 00000015 SystemOut O schema file: com.ibm.ws.classloader.Handler$ZipEntryInputStream @296f296f, xml file:java.io.FileInputStream@1f9b1f9b
    [15/03/11 14:40:06:062 EDT] 00000015 SystemOut O schema file: com.ibm.ws.classloader.Handler$ZipEntryInputStream @9b009b0, xml file:java.io.FileInputStream@7fea7fea
    [15/03/11 14:40:06:093 EDT] 00000015 SystemOut O schema file: com.ibm.ws.classloader.Handler$ZipEntryInputStream @179d179d, xml file:java.io.FileInputStream@ded0ded
    [15/03/11 14:40:06:109 EDT] 00000015 SystemOut O schema file: com.ibm.ws.classloader.Handler$ZipEntryInputStream @70147014, xml file:java.io.FileInputStream@4faf4faf
    [15/03/11 14:40:06:265 EDT] 00000015 SystemOut O schema file: com.ibm.ws.classloader.Handler$ZipEntryInputStream @75cc75cc, xml file:java.io.FileInputStream@6c1c6c1c
    [15/03/11 14:40:06:296 EDT] 00000015 SystemOut O schema file: com.ibm.ws.classloader.Handler$ZipEntryInputStream @1c941c94, xml file:java.io.FileInputStream@12b012b0
    [15/03/11 14:40:06:375 EDT] 00000015 SystemOut O Validating XML files ends.
    [15/03/11 14:40:09:796 EDT] 00000015 SystemOut O Encountered fatal error executing job
    org.springframework.batch.core.JobExecutionExcepti on: Flow execution ended unexpectedly
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:141)
    at org.springframework.batch.core.job.AbstractJob.exe cute(AbstractJob.java:281)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher$1.run(SimpleJobLauncher.java:120)
    at org.springframework.core.task.SyncTaskExecutor.exe cute(SyncTaskExecutor.java:48)
    at org.springframework.batch.core.launch.support.Simp leJobLauncher.run(SimpleJobLauncher.java:114)
    at com.bis.batch.quartz.AccuityJobLauncher.executeSpr ingBatchJob(AccuityJobLauncher.java:27)
    at com.bis.batch.quartz.AccuityVerificationQuartzJob. execute(AccuityVerificationQuartzJob.java:20)
    at org.quartz.core.JobRunShell.run(JobRunShell.java:2 16)
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run (SimpleThreadPool.java:549)
    Caused by: org.springframework.batch.core.job.flow.FlowExecut ionException: Ended flow=bisVerificationJob at state=bisVerificationJob.veriContact with exception
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:152)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.start(SimpleFlow.java:124)
    at org.springframework.batch.core.job.flow.FlowJob.do Execute(FlowJob.java:135)
    ... 8 more
    Caused by: java.lang.NullPointerException
    at java.util.concurrent.locks.ReentrantLock.lock(Reen trantLock.java:273)
    at java.util.concurrent.CopyOnWriteArrayList.addAllAb sent(CopyOnWriteArrayList.java:702)
    at java.util.concurrent.CopyOnWriteArraySet.addAll(Co pyOnWriteArraySet.java:264)
    at org.springframework.batch.core.JobExecution.addSte pExecutions(JobExecution.java:330)
    at org.springframework.batch.core.repository.dao.MapS tepExecutionDao.addStepExecutions(MapStepExecution Dao.java:132)
    at org.springframework.batch.core.repository.support. SimpleJobRepository.getLastStepExecution(SimpleJob Repository.java:195)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:45)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:37)
    at java.lang.reflect.Method.invoke(Method.java:599)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:309)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:183)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :150)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:110)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:202)
    at $Proxy42.getLastStepExecution(Unknown Source)
    at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(SimpleStepHandler.java:106)
    at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(JobFlowExecutor.java:61)
    at org.springframework.batch.core.job.flow.support.st ate.StepState.handle(StepState.java:60)
    at org.springframework.batch.core.job.flow.support.Si mpleFlow.resume(SimpleFlow.java:144)
    ... 10 more
    [15/03/11 14:40:09:796 EDT] 00000015 SystemOut O Finished executing job [bisVerificationJob]



    Spring configuration:

    <!-- Job definition -->
    <batch:job id="bisVerificationJob">
    <batch:step id="preReconcilation" >
    <batch:tasklet ref="preReconcilationTasklet"/>
    <batch:fail on="FAILED" exit-code="EARLY TERMINATION"/>
    <batch:next on="*" to="verification"/>
    </batch:step>
    <batch:step id="verification" next="veriLoc">
    <batch:tasklet>
    <batch:chunk reader="verificationResourceReader" writer="verificationItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="veriLoc" next="veriRtCode">
    <batch:tasklet>
    <batch:chunk reader="locResourceReader" writer="locItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="veriRtCode" next="veriRtCodeAttr">
    <batch:tasklet>
    <batch:chunk reader="rtCodeResourceReader" writer="rtCodeItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="veriRtCodeAttr" next="veriCor">
    <batch:tasklet>
    <batch:chunk reader="rtCodeAttrResourceReader" writer="rtCodeAttrItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="veriCor" next="veriContact">
    <batch:tasklet>
    <batch:chunk reader="corResourceReader" writer="corItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="veriContact" next="veriOfficer">
    <batch:tasklet>
    <batch:chunk reader="cntResourceReader" writer="cntItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:step id="veriOfficer">
    <batch:tasklet>
    <batch:chunk reader="offResourceReader" writer="offItemWriter" commit-interval="1"/>
    </batch:tasklet>
    </batch:step>
    <batch:listeners>
    <batch:listener ref="VeriJobListener"/>
    </batch:listeners>
    </batch:job>

  • #2
    Wow, that is awesome! A bug in the IBM JDK maybe? In any case I wouldn't recommend using the MapJobRepository in production. If you really need an in-memory repository, H2 is the best choice.

    Comment


    • #3
      MapRepositoryBean is not thread safe, can't really use it for anything beyond a simple hello world application.

      Comment


      • #4
        having exactly same trouble with spring-batch 2.1.9 and WebSphere7 bundled jdk
        looks like it's really a bug in CopyOnWriteArrayList in IBM JDK

        Comment

        Working...
        X