java.lang.NullPointerException

Spring JIRA | Petar Tahchiev | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  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 | 4 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 | 4 years ago | Petar Tahchiev
    java.lang.NullPointerException
  3. 0

    perl Regular Expression to find Java StackTrace by keyword

    Stack Overflow | 5 years ago | Gofrolist
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    openmeetings-user - [openmeetings-user] Install problems on centos 5.2 - msg#00087 - Recent Discussion OSDir.com

    osdir.com | 2 years ago
    java.lang.NullPointerException: null at org.openmeetings.app.hibernate.utils.HibernateUtil.createSession(HibernateUtil.java: 35) [openmeetings.jar:na] at org.openmeetings.app.data.basic.Configurationmanagement.getConfKey(Configurationmanagement.java: 50) [openmeetings.jar:na] at org.openmeetings.servlet.outputhandler.DefaultIndex.handleRequest(DefaultIndex.java: 38) [openmeetings.jar:na] at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(VelocityViewServlet.java: 541) [velocity-tools-view-1.3.jar:1.3] at org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(VelocityViewServlet.java: 507) [velocity-tools-view-1.3.jar:1.3]

    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