Announcement Announcement Module
No announcement yet.
NullPointerException when running multi-step job from WebSphere 6 Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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.



    [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:$ZipEntryInputStream @296f296f, xml
    [15/03/11 14:40:06:062 EDT] 00000015 SystemOut O schema file:$ZipEntryInputStream @9b009b0, xml
    [15/03/11 14:40:06:093 EDT] 00000015 SystemOut O schema file:$ZipEntryInputStream @179d179d, xml
    [15/03/11 14:40:06:109 EDT] 00000015 SystemOut O schema file:$ZipEntryInputStream @70147014, xml
    [15/03/11 14:40:06:265 EDT] 00000015 SystemOut O schema file:$ZipEntryInputStream @75cc75cc, xml
    [15/03/11 14:40:06:296 EDT] 00000015 SystemOut O schema file:$ZipEntryInputStream @1c941c94, xml
    [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 Execute(
    at org.springframework.batch.core.job.AbstractJob.exe cute(
    at leJobLauncher$
    at org.springframework.core.task.SyncTaskExecutor.exe cute(
    at com.bis.batch.quartz.AccuityJobLauncher.executeSpr ingBatchJob(
    at com.bis.batch.quartz.AccuityVerificationQuartzJob. execute(
    at 16)
    at org.quartz.simpl.SimpleThreadPool$ (
    Caused by: org.springframework.batch.core.job.flow.FlowExecut ionException: Ended flow=bisVerificationJob at state=bisVerificationJob.veriContact with exception
    at mpleFlow.resume(
    at mpleFlow.start(
    at Execute(
    ... 8 more
    Caused by: java.lang.NullPointerException
    at java.util.concurrent.locks.ReentrantLock.lock(Reen
    at java.util.concurrent.CopyOnWriteArrayList.addAllAb sent(
    at java.util.concurrent.CopyOnWriteArraySet.addAll(Co
    at org.springframework.batch.core.JobExecution.addSte pExecutions(
    at org.springframework.batch.core.repository.dao.MapS tepExecutionDao.addStepExecutions(MapStepExecution
    at SimpleJobRepository.getLastStepExecution(SimpleJob
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De
    at java.lang.reflect.Method.invoke(
    at npointUsingReflection(
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed( :150)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:110)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed( :172)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(
    at $Proxy42.getLastStepExecution(Unknown Source)
    at org.springframework.batch.core.job.SimpleStepHandl er.handleStep(
    at org.springframework.batch.core.job.flow.JobFlowExe cutor.executeStep(
    at ate.StepState.handle(
    at mpleFlow.resume(
    ... 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 id="verification" next="veriLoc">
    <batch:chunk reader="verificationResourceReader" writer="verificationItemWriter" commit-interval="1"/>
    <batch:step id="veriLoc" next="veriRtCode">
    <batch:chunk reader="locResourceReader" writer="locItemWriter" commit-interval="1"/>
    <batch:step id="veriRtCode" next="veriRtCodeAttr">
    <batch:chunk reader="rtCodeResourceReader" writer="rtCodeItemWriter" commit-interval="1"/>
    <batch:step id="veriRtCodeAttr" next="veriCor">
    <batch:chunk reader="rtCodeAttrResourceReader" writer="rtCodeAttrItemWriter" commit-interval="1"/>
    <batch:step id="veriCor" next="veriContact">
    <batch:chunk reader="corResourceReader" writer="corItemWriter" commit-interval="1"/>
    <batch:step id="veriContact" next="veriOfficer">
    <batch:chunk reader="cntResourceReader" writer="cntItemWriter" commit-interval="1"/>
    <batch:step id="veriOfficer">
    <batch:chunk reader="offResourceReader" writer="offItemWriter" commit-interval="1"/>
    <batch:listener ref="VeriJobListener"/>

  • #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.


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


      • #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