Results 1 to 3 of 3

Thread: NPE when closing JpaPagingItemReader

  1. #1
    Join Date
    Jul 2009
    Posts
    2

    Unhappy NPE when closing JpaPagingItemReader

    Hi,

    I have a test (running spring tests) that for no apparent reason (there has to be one ) has started to throw a NullPointerException when closing the JpaPagingItemReader. The reason appears to be that the EntityManager is null when the reader is invoking the doClose() method.

    I am using the last stable release 2.0.1. This is the exception cause:

    Code:
    Caused by: java.lang.NullPointerException
    	at org.springframework.batch.item.database.JpaPagingItemReader.doClose(JpaPagingItemReader.java:140)
    	at org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader.close(AbstractItemCountingItemStreamItemReader.java:98)
    	... 42 more
    I have tried with the 2.0.0 version to no avail. I fail to understand what kind of change in my side may have provoked this. How can it be that the EntityManager is null when closing the JpaPagingItemReader? I am not setting it to null myself anywhere...

    Thanks,

    Bruno

  2. #2
    Join Date
    Jun 2005
    Posts
    4,231

    Default

    Maybe the ItemReader was never opened? Is it a multithreaded step? Can you try a snapshot?

  3. #3
    Join Date
    Jul 2009
    Posts
    2

    Default

    The reason seems to be that I forgot to add the reader to the <batch:streams> section... now it seems to be working fine.

Posting Permissions

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