org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.mapping.RepositoryResourceMappings]: Factory method 'resourceMappings' threw exception; nested exception is java.lang.IllegalArgumentException: PersistentEntity must not be null!

  1. 0

    GitHub comment 1#164110202

    GitHub | 12 months ago | washawu
    java.lang.IllegalArgumentException: PersistentEntity must not be null!
  2. 0

    Hey there, here is some code which fails in gradle but works in eclipse and by calling the resource by an other service from outside. I would really appreciate some help on this. Is there also a way to come around marking SimpleAggregation as an Entity? At the moment it will be created in the database but I just need it for aggregational purpose. I tried some with projections (define it as an interface) and and also with EnableMapRepositories, but was not able to get it work. gradlew: 2.13 spring-boot: 1.3.5 {code} 2016-05-19 14:49:12.000 ERROR 12584 --- [o-auto-1-exec-5] o.s.d.r.w.RepositoryRestExceptionHandler : PersistentEntity must not be null! java.lang.IllegalArgumentException: PersistentEntity must not be null! at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.data.rest.webmvc.PersistentEntityResource$Builder.<init>(PersistentEntityResource.java:140) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResource$Builder.<init>(PersistentEntityResource.java:123) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResource.build(PersistentEntityResource.java:115) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.wrap(PersistentEntityResourceAssembler.java:74) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:55) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.entitiesToResources(AbstractRepositoryRestController.java:133) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.toResources(AbstractRepositoryRestController.java:80) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.toResource(AbstractRepositoryRestController.java:100) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:183) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458) [tomcat-embed-core-8.0.33.jar:8.0.33] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.33.jar:8.0.33] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40] {code} {code:title=SimpleAggregation.java|borderStyle=solid} @Entity @Getter @Setter public class SimpleAggregation implements Persistable<Long> { private static final long serialVersionUID = -5092557881988049420L; public SimpleAggregation() {} public SimpleAggregation(String category, BigDecimal value) { this.category = category; this.value = value; } @Id private Long id = 0L; private String category; private BigDecimal value; @Override public boolean isNew() { // TODO Auto-generated method stub return false; } @Override public Long getId() { // TODO Auto-generated method stub return null; } } {code} {code:title=BookingRepository.java|borderStype=solid} @Transactional @RepositoryRestResource(collectionResourceRel = "booking", path = "booking") public interface BookingRepository extends JpaRepository<Booking, Long> { @Query("SELECT new lessor.persistence.SimpleAggregation(Concat(b.bookingDate) AS category, Coalesce(SUM(b.value),0) AS value) " + "FROM Booking b INNER JOIN b.rentalProperty rp INNER JOIN rp.account a " + "WHERE b.bookingDate BETWEEN :fromDate AND :toDate " + " AND (b.rentalProperty.itemId = :rentalPropertyId OR :rentalPropertyId IS NULL) " + " AND (b.bookingClass.itemId = :bookingClassId OR :bookingClassId IS NULL) " + " AND a.itemId = :accountId " + "GROUP BY b.bookingDate " + "ORDER BY b.bookingDate") List<SimpleAggregation> aggregateBookingValuePerBookingDay(@Param("accountId") Long accountId, @Param("rentalPropertyId") Long rentalPropertyId , @Param("bookingClassId") Long bookingClassId , @DateTimeFormat(iso=ISO.DATE, pattern="yyyy-MM-dd")@Param("fromDate") LocalDate fromDate , @DateTimeFormat(iso=ISO.DATE, pattern="yyyy-MM-dd")@Param("toDate") LocalDate toDate); } {code} Code to excecute within my integration test looks like this: {code} String url = bookingSearchAggregateBookingValuePerBookingDay + "?" + "accountId=" + EXPECTED_ACCOUNT_ID + "&fromDate=" + EXPECTED_BOOKING_SEARCH_FROM_DATE + "&toDate=" + EXPECTED_BOOKING_SEARCH_TILL_DATE; RequestEntity<Void> request = RequestEntity.get(URI.create(url)) .accept(MediaTypes.HAL_JSON).acceptCharset(Charset.forName("UTF-8")).build(); ResponseEntity<Resources<SimpleAggregation>> bookingResourcesEntity = restTemplate.exchange(request, new ParameterizedTypeReference<Resources<SimpleAggregation>>() {}); {code} Thanks for your help!

    Spring JIRA | 7 months ago | Karsten Ludwig Hauser
    java.lang.IllegalArgumentException: PersistentEntity must not be null!
  3. 0

    Error Spring Data Neo4j in docker image

    Stack Overflow | 4 months ago | Primael Bruant
    org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.rest.core.mapping.RepositoryResourceMappings]: Factory method 'resourceMappings' threw exception; nested exception is java.lang.IllegalArgumentException: PersistentEntity must not be null!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Hey there, here is some code which fails in gradle but works in eclipse and by calling the resource by an other service from outside. I would really appreciate some help on this. Is there also a way to come around marking SimpleAggregation as an Entity? At the moment it will be created in the database but I just need it for aggregational purpose. I tried some with projections (define it as an interface) and and also with EnableMapRepositories, but was not able to get it work. gradlew: 2.13 spring-boot: 1.3.5 {code} 2016-05-19 14:49:12.000 ERROR 12584 --- [o-auto-1-exec-5] o.s.d.r.w.RepositoryRestExceptionHandler : PersistentEntity must not be null! java.lang.IllegalArgumentException: PersistentEntity must not be null! at org.springframework.util.Assert.notNull(Assert.java:115) ~[spring-core-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.data.rest.webmvc.PersistentEntityResource$Builder.<init>(PersistentEntityResource.java:140) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResource$Builder.<init>(PersistentEntityResource.java:123) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResource.build(PersistentEntityResource.java:115) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.wrap(PersistentEntityResourceAssembler.java:74) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:55) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.entitiesToResources(AbstractRepositoryRestController.java:133) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.toResources(AbstractRepositoryRestController.java:80) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.toResource(AbstractRepositoryRestController.java:100) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:183) ~[spring-data-rest-webmvc-2.5.1.RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_40] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_40] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_40] at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_40] at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136) ~[spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:832) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:743) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:961) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:895) ~[spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:622) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843) [spring-webmvc-4.2.6.RELEASE.jar:4.2.6.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:729) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) [tomcat-embed-websocket-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:87) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:121) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.2.6.RELEASE.jar:4.2.6.RELEASE] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1502) [tomcat-embed-core-8.0.33.jar:8.0.33] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1458) [tomcat-embed-core-8.0.33.jar:8.0.33] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [na:1.8.0_40] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [na:1.8.0_40] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.0.33.jar:8.0.33] at java.lang.Thread.run(Thread.java:745) [na:1.8.0_40] {code} {code:title=SimpleAggregation.java|borderStyle=solid} @Entity @Getter @Setter public class SimpleAggregation implements Persistable<Long> { private static final long serialVersionUID = -5092557881988049420L; public SimpleAggregation() {} public SimpleAggregation(String category, BigDecimal value) { this.category = category; this.value = value; } @Id private Long id = 0L; private String category; private BigDecimal value; @Override public boolean isNew() { // TODO Auto-generated method stub return false; } @Override public Long getId() { // TODO Auto-generated method stub return null; } } {code} {code:title=BookingRepository.java|borderStype=solid} @Transactional @RepositoryRestResource(collectionResourceRel = "booking", path = "booking") public interface BookingRepository extends JpaRepository<Booking, Long> { @Query("SELECT new lessor.persistence.SimpleAggregation(Concat(b.bookingDate) AS category, Coalesce(SUM(b.value),0) AS value) " + "FROM Booking b INNER JOIN b.rentalProperty rp INNER JOIN rp.account a " + "WHERE b.bookingDate BETWEEN :fromDate AND :toDate " + " AND (b.rentalProperty.itemId = :rentalPropertyId OR :rentalPropertyId IS NULL) " + " AND (b.bookingClass.itemId = :bookingClassId OR :bookingClassId IS NULL) " + " AND a.itemId = :accountId " + "GROUP BY b.bookingDate " + "ORDER BY b.bookingDate") List<SimpleAggregation> aggregateBookingValuePerBookingDay(@Param("accountId") Long accountId, @Param("rentalPropertyId") Long rentalPropertyId , @Param("bookingClassId") Long bookingClassId , @DateTimeFormat(iso=ISO.DATE, pattern="yyyy-MM-dd")@Param("fromDate") LocalDate fromDate , @DateTimeFormat(iso=ISO.DATE, pattern="yyyy-MM-dd")@Param("toDate") LocalDate toDate); } {code} Code to excecute within my integration test looks like this: {code} String url = bookingSearchAggregateBookingValuePerBookingDay + "?" + "accountId=" + EXPECTED_ACCOUNT_ID + "&fromDate=" + EXPECTED_BOOKING_SEARCH_FROM_DATE + "&toDate=" + EXPECTED_BOOKING_SEARCH_TILL_DATE; RequestEntity<Void> request = RequestEntity.get(URI.create(url)) .accept(MediaTypes.HAL_JSON).acceptCharset(Charset.forName("UTF-8")).build(); ResponseEntity<Resources<SimpleAggregation>> bookingResourcesEntity = restTemplate.exchange(request, new ParameterizedTypeReference<Resources<SimpleAggregation>>() {}); {code} Thanks for your help!

    Spring JIRA | 7 months ago | Karsten Ludwig Hauser
    java.lang.IllegalArgumentException: PersistentEntity must not be null!
  6. 0

    JPARepository return single field only

    Stack Overflow | 3 months ago | apurv
    java.lang.IllegalArgumentException: PersistentEntity must not be null!

  1. batwalrus76 4 times, last 3 weeks ago
  2. serious2monkeys 1 times, last 3 weeks ago
  3. tvrmsmith 1 times, last 1 month ago
  4. fima 1 times, last 2 months ago
  5. dafman 2 times, last 2 months ago
8 more registered users
87 unregistered visitors
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.IllegalArgumentException

    PersistentEntity must not be null!

    at org.springframework.util.Assert.notNull()
  2. Spring Core
    Assert.notNull
    1. org.springframework.util.Assert.notNull(Assert.java:115)[spring-core-4.3.2.RELEASE.jar!/:4.3.2.RELEASE]
    1 frame