java.lang.NullPointerException

Spring JIRA | Dino Marzi | 8 years ago
  1. 0

    Using an ItemOrientedStep with the following combination of ItemReader and ItemWriter ... <!-- other tags --> <bean id="testFileItemReader" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="record" /> <property name="resource" value="classpath:doesntexist.xml" /> <property name="fragmentDeserializer"> <bean class="org.springframework.batch.item.xml.oxm.UnmarshallingEventReaderDeserializer"> <constructor-arg ref="jaxb2Marshaller" /> </bean> </property> </bean> <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="${context.path}" /> <property name="schema" value="classpath:${input.schema}" /> </bean> <bean class="org.springframework.batch.item.xml.StaxEventItemWriter" id="testFileItemWriter"> <property name="resource" value="file:${output.resource}" /> <property name="serializer" ref="marshallingSerializer" /> <property name="rootTagName" value="records" /> <property name="overwriteOutput" value="true" /> </bean> <bean class="org.springframework.batch.item.xml.oxm.MarshallingEventWriterSerializer" id="marshallingSerializer"> <constructor-arg ref="jaxb2Marshaller" /> </bean> will lead to a NullPointerException in the execution of the ItemWriter if the resource configured for the ItemReader doesn't exist (for example due to an unintentional typo). This behavior makes it rather difficult to analyze the error and find the true cause. There should be a more sophisticated error handling if the StaxEventItemReader can't find its resource. Log entry: ERROR AbstractStep - Encountered an error executing the step: class org.springframework.batch.core.UnexpectedJobExecutionException: Failed to initialize the step ERROR AbstractStep - Exception while closing step execution resources java.lang.NullPointerException at org.springframework.batch.item.xml.StaxEventItemWriter.flush(StaxEventItemWriter.java:463) at org.springframework.batch.item.xml.StaxEventItemWriter.close(StaxEventItemWriter.java:373) at org.springframework.batch.item.support.CompositeItemStream.close(CompositeItemStream.java:90) at org.springframework.batch.core.step.item.ItemOrientedStep.close(ItemOrientedStep.java:435) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:226) at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:100) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81) at com.tsystems.favbg.batch.job.TestJobTest.testLaunchJob(TestJobTest.java:83) 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 junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76) at junit.framework.TestResult$1.protect(TestResult.java: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:230) at junit.framework.TestSuite.run(TestSuite.java:225) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Spring JIRA | 8 years ago | Dino Marzi
    java.lang.NullPointerException
  2. 0

    Using an ItemOrientedStep with the following combination of ItemReader and ItemWriter ... <!-- other tags --> <bean id="testFileItemReader" class="org.springframework.batch.item.xml.StaxEventItemReader"> <property name="fragmentRootElementName" value="record" /> <property name="resource" value="classpath:doesntexist.xml" /> <property name="fragmentDeserializer"> <bean class="org.springframework.batch.item.xml.oxm.UnmarshallingEventReaderDeserializer"> <constructor-arg ref="jaxb2Marshaller" /> </bean> </property> </bean> <bean id="jaxb2Marshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPath" value="${context.path}" /> <property name="schema" value="classpath:${input.schema}" /> </bean> <bean class="org.springframework.batch.item.xml.StaxEventItemWriter" id="testFileItemWriter"> <property name="resource" value="file:${output.resource}" /> <property name="serializer" ref="marshallingSerializer" /> <property name="rootTagName" value="records" /> <property name="overwriteOutput" value="true" /> </bean> <bean class="org.springframework.batch.item.xml.oxm.MarshallingEventWriterSerializer" id="marshallingSerializer"> <constructor-arg ref="jaxb2Marshaller" /> </bean> will lead to a NullPointerException in the execution of the ItemWriter if the resource configured for the ItemReader doesn't exist (for example due to an unintentional typo). This behavior makes it rather difficult to analyze the error and find the true cause. There should be a more sophisticated error handling if the StaxEventItemReader can't find its resource. Log entry: ERROR AbstractStep - Encountered an error executing the step: class org.springframework.batch.core.UnexpectedJobExecutionException: Failed to initialize the step ERROR AbstractStep - Exception while closing step execution resources java.lang.NullPointerException at org.springframework.batch.item.xml.StaxEventItemWriter.flush(StaxEventItemWriter.java:463) at org.springframework.batch.item.xml.StaxEventItemWriter.close(StaxEventItemWriter.java:373) at org.springframework.batch.item.support.CompositeItemStream.close(CompositeItemStream.java:90) at org.springframework.batch.core.step.item.ItemOrientedStep.close(ItemOrientedStep.java:435) at org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:226) at org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:100) at org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86) at org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49) at org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81) at com.tsystems.favbg.batch.job.TestJobTest.testLaunchJob(TestJobTest.java:83) 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 junit.framework.TestCase.runTest(TestCase.java:164) at junit.framework.TestCase.runBare(TestCase.java:130) at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76) at junit.framework.TestResult$1.protect(TestResult.java: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:230) at junit.framework.TestSuite.run(TestSuite.java:225) at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

    Spring JIRA | 8 years ago | Dino Marzi
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.batch.item.xml.StaxEventItemWriter.flush()
    2. Spring Batch Infrastructure
      CompositeItemStream.close
      1. org.springframework.batch.item.xml.StaxEventItemWriter.flush(StaxEventItemWriter.java:463)
      2. org.springframework.batch.item.xml.StaxEventItemWriter.close(StaxEventItemWriter.java:373)
      3. org.springframework.batch.item.support.CompositeItemStream.close(CompositeItemStream.java:90)
      3 frames
    3. Spring Batch Core
      SimpleJobLauncher$1.run
      1. org.springframework.batch.core.step.item.ItemOrientedStep.close(ItemOrientedStep.java:435)
      2. org.springframework.batch.core.step.AbstractStep.execute(AbstractStep.java:226)
      3. org.springframework.batch.core.job.SimpleJob.execute(SimpleJob.java:100)
      4. org.springframework.batch.core.launch.support.SimpleJobLauncher$1.run(SimpleJobLauncher.java:86)
      4 frames
    4. Spring Core
      SyncTaskExecutor.execute
      1. org.springframework.core.task.SyncTaskExecutor.execute(SyncTaskExecutor.java:49)
      1 frame
    5. Spring Batch Core
      SimpleJobLauncher.run
      1. org.springframework.batch.core.launch.support.SimpleJobLauncher.run(SimpleJobLauncher.java:81)
      1 frame
    6. com.tsystems.favbg
      TestJobTest.testLaunchJob
      1. com.tsystems.favbg.batch.job.TestJobTest.testLaunchJob(TestJobTest.java:83)
      1 frame
    7. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      4. java.lang.reflect.Method.invoke(Method.java:585)
      4 frames
    8. JUnit
      TestCase.runBare
      1. junit.framework.TestCase.runTest(TestCase.java:164)
      2. junit.framework.TestCase.runBare(TestCase.java:130)
      2 frames
    9. Spring TestContext
      ConditionalTestCase.runBare
      1. org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java:76)
      1 frame
    10. JUnit
      TestSuite.run
      1. junit.framework.TestResult$1.protect(TestResult.java:106)
      2. junit.framework.TestResult.runProtected(TestResult.java:124)
      3. junit.framework.TestResult.run(TestResult.java:109)
      4. junit.framework.TestCase.run(TestCase.java:120)
      5. junit.framework.TestSuite.runTest(TestSuite.java:230)
      6. junit.framework.TestSuite.run(TestSuite.java:225)
      6 frames
    11. JUnit3 Runner
      RemoteTestRunner.main
      1. org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
      2. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
      3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
      4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
      5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
      6. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
      6 frames