java.lang.IllegalArgumentException: Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found!

Spring JIRA | Jega A | 3 years ago
  1. 0

    I am working on a POC that involves using spring-data-solr to access Solr server and the results available as a REST. For the REST service I am using spring-data-rest-webmvc package. When I try to access the Solr using a REST call I get the following error: http://localhost:8080/contracts_search/search/findById?id=1000 { "cause" : null, "message" : "Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found!" } The stack trace Stack Trace 2014-05-17 18:12:10.065 ERROR 17172 --- [nio-8080-exec-4] s.d.r.w.AbstractRepositoryRestController : Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found! java.lang.IllegalArgumentException: Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found! at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:81) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:64) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.resultToResources(AbstractRepositoryRestController.java:213) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:222) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) pom.xml (dependencies only) <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-solr</artifactId> <version>1.2.0.RC1</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-webmvc</artifactId> <version>2.1.0.RC1</version> </dependency> </dependencies> My test case is very simple accessing Solr documents with just a few fields. Can post code if more details is needed? Any ideas on where to start looking?

    Spring JIRA | 3 years ago | Jega A
    java.lang.IllegalArgumentException: Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found!
  2. 0

    I am working on a POC that involves using spring-data-solr to access Solr server and the results available as a REST. For the REST service I am using spring-data-rest-webmvc package. When I try to access the Solr using a REST call I get the following error: http://localhost:8080/contracts_search/search/findById?id=1000 { "cause" : null, "message" : "Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found!" } The stack trace Stack Trace 2014-05-17 18:12:10.065 ERROR 17172 --- [nio-8080-exec-4] s.d.r.w.AbstractRepositoryRestController : Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found! java.lang.IllegalArgumentException: Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found! at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:81) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:64) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.resultToResources(AbstractRepositoryRestController.java:213) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:222) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:135) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) pom.xml (dependencies only) <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-solr</artifactId> <version>1.2.0.RC1</version> </dependency> <dependency> <groupId>org.springframework.data</groupId> <artifactId>spring-data-rest-webmvc</artifactId> <version>2.1.0.RC1</version> </dependency> </dependencies> My test case is very simple accessing Solr documents with just a few fields. Can post code if more details is needed? Any ideas on where to start looking?

    Spring JIRA | 3 years ago | Jega A
    java.lang.IllegalArgumentException: Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found!
  3. 0

    I'm trying to have spring-data-solr and spring-data-rest-webmvc work together. Apologies in advance if I'm doing something wrong, or missing some configuration/setting, there doesn't seem to be any great examples on the web of integrating these two components. From what I can see, after setting breakpoints and debugging things in my local environment, the mappingContext is not being set by {{org.springframework.data.solr.repository.support.SolrRepositoryFactoryBean}}, which results in the following exception when running queries against my solr-repositories: {code} java.lang.IllegalArgumentException: Cannot create self link for class com.ibm.cayce.coy.domain.Product! No persistent entity found! at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:81) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:64) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.entitiesToResources(AbstractRepositoryRestController.java:229) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.resultToResources(AbstractRepositoryRestController.java:209) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:222) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:135) {code} From my debugging: {{org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport:getPersistentEntity()}} is returning null because the mappingContext is always null. I'm attaching a simple patch that "fixes" things and makes it work, but, I'm not familiar enough with the code base to know if its the "right" fix. There's probably a better place to call setMappingContext than where I added it, it was mostly just a test to see if that fixes things, and sure enough it does. Can someone look at this asap and commit a proper fix? Thanks!!

    Spring JIRA | 3 years ago | Aaron LaBella
    java.lang.IllegalArgumentException: Cannot create self link for class com.ibm.cayce.coy.domain.Product! No persistent entity found!
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    I am getting above error when trying to get retrieving information. I am using the following URL: {{http://localhost:9000/agency/search/findAgencyByZip?zip=02019}}. And the table structure is attached in the issue, database used is oracle. Query is as below in the {{AgencyRepository}}. {code:java} interface AgencyRepository … { @Query("SELECT DISTINCT a, l.contactInfo.address.city, l.contactInfo.address.street, l.contactInfo.phone from Agency a, Location l INNER JOIN l.zips z where a.ceID = l.agencyCode and z.zipCode = :zip") public List<Agency> findAgencyByZip(@Param("zip") String zip); } {code} {code} java.lang.IllegalArgumentException: Cannot create self link for class [Ljava.lang.Object;! No persistent entity found! at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:81) ~[spring-data-rest-webmvc-2.1.4.RELEASE.jar:na] at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:64) ~[spring-data-rest-webmvc-2.1.4.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.entitiesToResources(AbstractRepositoryRestController.java:223) ~[spring-data-rest-webmvc-2.1.4.RELEASE.jar:na] at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.resultToResources(AbstractRepositoryRestController.java:203) ~[spring-data-rest-webmvc-2.1.4.RELEASE.jar:na] at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:242) ~[spring-data-rest-webmvc-2.1.4.RELEASE.jar:na] at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:146) ~[spring-data-rest-webmvc-2.1.4.RELEASE.jar:na] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_71] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_71] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_71] at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_71] at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:215) ~[spring-web-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132) ~[spring-web-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) ~[spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749) ~[spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689) ~[spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83) ~[spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938) ~[spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870) ~[spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961) [spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:852) [spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:668) [javax.servlet-api-3.0.1.jar:3.0.1] at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837) [spring-webmvc-4.0.8.RELEASE.jar:4.0.8.RELEASE] at javax.servlet.http.HttpServlet.service(HttpServlet.java:770) [javax.servlet-api-3.0.1.jar:3.0.1] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1736) [tomcat-embed-core-7.0.57.jar:7.0.57] at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1695) [tomcat-embed-core-7.0.57.jar:7.0.57] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_71] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_71] at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-7.0.57.jar:7.0.57] at java.lang.Thread.run(Thread.java:745) [na:1.7.0_71] {code}

    Spring JIRA | 2 years ago | chetan kokil
    java.lang.IllegalArgumentException: Cannot create self link for class [Ljava.lang.Object;! No persistent entity found!
  6. 0

    I'm trying to have spring-data-solr and spring-data-rest-webmvc work together. Apologies in advance if I'm doing something wrong, or missing some configuration/setting, there doesn't seem to be any great examples on the web of integrating these two components. From what I can see, after setting breakpoints and debugging things in my local environment, the mappingContext is not being set by {{org.springframework.data.solr.repository.support.SolrRepositoryFactoryBean}}, which results in the following exception when running queries against my solr-repositories: {code} java.lang.IllegalArgumentException: Cannot create self link for class com.ibm.cayce.coy.domain.Product! No persistent entity found! at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:81) at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:64) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.entitiesToResources(AbstractRepositoryRestController.java:229) at org.springframework.data.rest.webmvc.AbstractRepositoryRestController.resultToResources(AbstractRepositoryRestController.java:209) at org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:222) at org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:135) {code} From my debugging: {{org.springframework.data.repository.core.support.RepositoryFactoryBeanSupport:getPersistentEntity()}} is returning null because the mappingContext is always null. I'm attaching a simple patch that "fixes" things and makes it work, but, I'm not familiar enough with the code base to know if its the "right" fix. There's probably a better place to call setMappingContext than where I added it, it was mostly just a test to see if that fixes things, and sure enough it does. Can someone look at this asap and commit a proper fix? Thanks!!

    Spring JIRA | 3 years ago | Aaron LaBella
    java.lang.IllegalArgumentException: Cannot create self link for class com.ibm.cayce.coy.domain.Product! No persistent entity found!

    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

      Cannot create self link for class com.sample.solr.document.Contract! No persistent entity found!

      at org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor()
    2. Spring Data REST - WebMVC
      RepositorySearchController.executeSearch
      1. org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.getSelfLinkFor(PersistentEntityResourceAssembler.java:81)
      2. org.springframework.data.rest.webmvc.PersistentEntityResourceAssembler.toResource(PersistentEntityResourceAssembler.java:64)
      3. org.springframework.data.rest.webmvc.AbstractRepositoryRestController.resultToResources(AbstractRepositoryRestController.java:213)
      4. org.springframework.data.rest.webmvc.RepositorySearchController.executeQueryMethod(RepositorySearchController.java:222)
      5. org.springframework.data.rest.webmvc.RepositorySearchController.executeSearch(RepositorySearchController.java:135)
      5 frames
    3. Java RT
      DelegatingMethodAccessorImpl.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      3 frames