# DateFormat throws null Pointer in 4.2.x

**URL:** <https://discuss.elastic.co/t/dateformat-throws-null-pointer-in-4-2-x/277483>\
**Category:** Elasticsearch\
**Tags:** language-clients\
**Created:** [June 30, 2021, 3:27pm UTC](https://discuss.elastic.co/t/dateformat-throws-null-pointer-in-4-2-x/277483 "2021-06-30T15:27:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kst](https://avatars.discourse-cdn.com/v4/letter/k/dfb087/32.png) [@Kst](https://discuss.elastic.co/u/Kst)\
**Post date:** [June 30, 2021, 3:27pm UTC](https://discuss.elastic.co/t/dateformat-throws-null-pointer-in-4-2-x/277483/1 "2021-06-30T15:27:37Z")

</div>

Hi,  
I am trying to upgrade spring data Elasticsearch from 4.1.10 to 4.2.2

I have a date field definition like below

> **@Field(type = FieldType.Date, format = DateFormat.date\_optional\_time, index = false)**  
> private LocalDate executionDate

It works with spring data Elasticsearch 4.1.10 but fails in 4.2.x (4.2.0, 4.2.1, 4.2.2).  
Getting the below error in bean creation of repository.

> Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.isEnum()" because "componentType" is null

Have tried many formats.  
**Using the keyword "format" or "pattern" inside @Field throws this error.**  
Any suggestion would greatly help .

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [July 1, 2021, 2:13pm UTC](https://discuss.elastic.co/t/dateformat-throws-null-pointer-in-4-2-x/277483/2 "2021-07-01T14:13:36Z")

</div>

can you share a full java class as well as a full stack trace, please. Thank you!

---

<div class="post-metadata">

**Author:** ![Kst](https://avatars.discourse-cdn.com/v4/letter/k/dfb087/32.png) [@Kst](https://discuss.elastic.co/u/Kst)\
**Post date:** [July 20, 2021, 6:31am UTC](https://discuss.elastic.co/t/dateformat-throws-null-pointer-in-4-2-x/277483/3 "2021-07-20T06:31:08Z")

</div>

Thanks for the quick response Alexander.  
The issue was due to a conflict in my ES version.

I have fixed the same.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [August 17, 2021, 6:31am UTC](https://discuss.elastic.co/t/dateformat-throws-null-pointer-in-4-2-x/277483/4 "2021-08-17T06:31:20Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
