java.lang.NullPointerException

Spring JIRA | Petar Tahchiev | 3 years ago
  1. 0

    Hi guys, I'm trying out the spring data project, and I really love it :) ... However, I get this null-pointer exception, because my classpath contains a spring-data-elasticsearch repository: {code} 2013-08-20 16:16:18,838 [qtp1098209814-127] ERROR org.springframework.data.rest.webmvc.RepositoryEntityController - java.lang.NullPointerException at org.springframework.data.rest.repository.support.RepositoryInformationSupport.findRepositoryInfoFor(RepositoryInformationSupport.java:61) at org.springframework.data.rest.webmvc.RepositoryInformationHandlerMethodArgumentResolver.resolveArgument(RepositoryInformationHandlerMethodArgumentResolver.java:44) at org.springframework.data.rest.webmvc.RepositoryRestRequestHandlerMethodArgumentResolver.resolveArgument(RepositoryRestRequestHandlerMethodArgumentResolver.java:46) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) {code} I debugged it, and I saw that here in this for loop: {code} for(Class<?> domainType : repositories) { RepositoryInformation repoInfo = findRepositoryInfoFor(domainType); ResourceMapping mapping = getResourceMapping(config, repoInfo); if(pathSegment.equals(mapping.getPath()) && mapping.isExported()) { return repoInfo; } } {code} repoInfo gets resolved as null and mapping as well. Then inside the if statement the null-pointer occurs. BTW, I think the same error will occur if the classpath contains spring-data-solr repositories. Cheers

    Spring JIRA | 3 years ago | Petar Tahchiev
    java.lang.NullPointerException
  2. 0

    Hi guys, I'm trying out the spring data project, and I really love it :) ... However, I get this null-pointer exception, because my classpath contains a spring-data-elasticsearch repository: {code} 2013-08-20 16:16:18,838 [qtp1098209814-127] ERROR org.springframework.data.rest.webmvc.RepositoryEntityController - java.lang.NullPointerException at org.springframework.data.rest.repository.support.RepositoryInformationSupport.findRepositoryInfoFor(RepositoryInformationSupport.java:61) at org.springframework.data.rest.webmvc.RepositoryInformationHandlerMethodArgumentResolver.resolveArgument(RepositoryInformationHandlerMethodArgumentResolver.java:44) at org.springframework.data.rest.webmvc.RepositoryRestRequestHandlerMethodArgumentResolver.resolveArgument(RepositoryRestRequestHandlerMethodArgumentResolver.java:46) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936) at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827) at javax.servlet.http.HttpServlet.service(HttpServlet.java:735) {code} I debugged it, and I saw that here in this for loop: {code} for(Class<?> domainType : repositories) { RepositoryInformation repoInfo = findRepositoryInfoFor(domainType); ResourceMapping mapping = getResourceMapping(config, repoInfo); if(pathSegment.equals(mapping.getPath()) && mapping.isExported()) { return repoInfo; } } {code} repoInfo gets resolved as null and mapping as well. Then inside the if statement the null-pointer occurs. BTW, I think the same error will occur if the classpath contains spring-data-solr repositories. Cheers

    Spring JIRA | 3 years ago | Petar Tahchiev
    java.lang.NullPointerException
  3. 0

    Android: Saving Map State in Google map

    Stack Overflow | 11 months ago | Junie Negentien
    java.lang.RuntimeException: Unable to resume activity {com.ourThesis.junieNegentien2015/com.ourThesis.junieNegentien2015.MainActivity}: java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    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.NullPointerException

      No message provided

      at org.springframework.data.rest.repository.support.RepositoryInformationSupport.findRepositoryInfoFor()
    2. Spring Data REST
      RepositoryInformationSupport.findRepositoryInfoFor
      1. org.springframework.data.rest.repository.support.RepositoryInformationSupport.findRepositoryInfoFor(RepositoryInformationSupport.java:61)
      1 frame
    3. Spring Data REST - WebMVC
      RepositoryRestRequestHandlerMethodArgumentResolver.resolveArgument
      1. org.springframework.data.rest.webmvc.RepositoryInformationHandlerMethodArgumentResolver.resolveArgument(RepositoryInformationHandlerMethodArgumentResolver.java:44)
      2. org.springframework.data.rest.webmvc.RepositoryRestRequestHandlerMethodArgumentResolver.resolveArgument(RepositoryRestRequestHandlerMethodArgumentResolver.java:46)
      2 frames
    4. Spring
      InvocableHandlerMethod.invokeForRequest
      1. org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:77)
      2. org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:162)
      3. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:123)
      3 frames
    5. Spring MVC
      FrameworkServlet.doGet
      1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
      2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:745)
      3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:686)
      4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:80)
      5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:925)
      6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:856)
      7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:936)
      8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:827)
      8 frames
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:735)
      1 frame