java.lang.NullPointerException: null

Stack Overflow | mc20 | 7 months ago
tip
Click on the to mark the solution that helps you, Samebug will learn from it.
As a community member, you’ll be rewarded for you help.

Root Cause Analysis

  1. java.lang.NullPointerException

    null

    at com.teja.controller.CategoryController.getAllCategories()
  2. com.teja.controller
    CategoryController.getAllCategories
    1. com.teja.controller.CategoryController.getAllCategories(CategoryController.java:23)[classes/:na]
    1 frame
  3. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_73]
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_73]
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_73]
    4. java.lang.reflect.Method.invoke(Method.java:497)[na:1.8.0_73]
    4 frames
  4. Spring
    InvocableHandlerMethod.invokeForRequest
    1. org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)[spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    2. org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:137)[spring-web-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    2 frames
  5. Spring MVC
    FrameworkServlet.doGet
    1. org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:110)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    2. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:776)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    3. org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:705)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    4. org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    5. org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    6. org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:893)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    7. org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:967)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    8. org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:858)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    8 frames
  6. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:622)[tomcat-embed-core-8.0.23.jar:8.0.23]
    1 frame
  7. Spring MVC
    FrameworkServlet.service
    1. org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:843)[spring-webmvc-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    1 frame
  8. Spring TestContext
    TestDispatcherServlet.service
    1. org.springframework.test.web.servlet.TestDispatcherServlet.service(TestDispatcherServlet.java:65)[spring-test-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    1 frame
  9. JavaServlet
    HttpServlet.service
    1. javax.servlet.http.HttpServlet.service(HttpServlet.java:729)[tomcat-embed-core-8.0.23.jar:8.0.23]
    1 frame
  10. Spring TestContext
    MockMvc.perform
    1. org.springframework.mock.web.MockFilterChain$ServletFilterProxy.doFilter(MockFilterChain.java:167)[spring-test-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    2. org.springframework.mock.web.MockFilterChain.doFilter(MockFilterChain.java:134)[spring-test-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    3. org.springframework.test.web.servlet.MockMvc.perform(MockMvc.java:144)[spring-test-4.1.7.RELEASE.jar:4.1.7.RELEASE]
    3 frames
  11. Unknown
    CategoryControllerTest.categories_ShouldRenderCategoriesView
    1. CategoryControllerTest.categories_ShouldRenderCategoriesView(CategoryControllerTest.java:46)[classes/:na]
    1 frame
  12. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_73]
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_73]
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_73]
    4. java.lang.reflect.Method.invoke(Method.java:497)[na:1.8.0_73]
    4 frames
  13. JUnit
    ParentRunner.run
    1. org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)[junit-4.12.jar:4.12]
    2. org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)[junit-4.12.jar:4.12]
    3. org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)[junit-4.12.jar:4.12]
    4. org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)[junit-4.12.jar:4.12]
    5. org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)[junit-4.12.jar:4.12]
    6. org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)[junit-4.12.jar:4.12]
    7. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)[junit-4.12.jar:4.12]
    8. org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)[junit-4.12.jar:4.12]
    9. org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)[junit-4.12.jar:4.12]
    10. org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)[junit-4.12.jar:4.12]
    11. org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)[junit-4.12.jar:4.12]
    12. org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)[junit-4.12.jar:4.12]
    13. org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)[junit-4.12.jar:4.12]
    14. org.junit.runners.ParentRunner.run(ParentRunner.java:363)[junit-4.12.jar:4.12]
    14 frames
  14. Mockito
    MockitoJUnitRunner.run
    1. org.mockito.internal.runners.JUnit45AndHigherRunnerImpl.run(JUnit45AndHigherRunnerImpl.java:37)[mockito-core-1.10.19.jar:na]
    2. org.mockito.runners.MockitoJUnitRunner.run(MockitoJUnitRunner.java:62)[mockito-core-1.10.19.jar:na]
    2 frames
  15. JUnit4 Runner
    JUnit4TestReference.run
    1. org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)[.cp/:na]
    1 frame
  16. JUnit3 Runner
    RemoteTestRunner.main
    1. org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)[.cp/:na]
    2. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)[.cp/:na]
    3. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)[.cp/:na]
    4. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)[.cp/:na]
    5. org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)[.cp/:na]
    5 frames