Skip to content

NullPointerException for interface based projection #2416

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
makigumo opened this issue Jan 22, 2022 · 2 comments
Closed

NullPointerException for interface based projection #2416

makigumo opened this issue Jan 22, 2022 · 2 comments

Comments

@makigumo
Copy link

Hello, after updating to the latest spring boot release 2.6.3 I'm met with the NullPointerException below.

The following change (#2363 8cd1388) seems to be the cause.

I'm using a simple recursive interface based projection with a query method, similar to Example 81 in https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#projections, which has worked until now.

[..]
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.isInterface()" because "typeToRead" is null
	at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:181)
	at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:152)
	at org.springframework.data.jpa.repository.query.JpaQueryCreator.complete(JpaQueryCreator.java:59)
	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:95)
	at org.springframework.data.repository.query.parser.AbstractQueryCreator.createQuery(AbstractQueryCreator.java:81)
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Class.isInterface()" because "typeToRead" is null
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 22, 2022
@Eng-Fouad
Copy link
Contributor

I got the same error after upgrading to Spring boot 2.6.3.

@makigumo
Copy link
Author

Closing, duplicate of #2408

@odrotbohm odrotbohm removed the status: waiting-for-triage An issue we've not yet triaged label Jan 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants