java.lang.NullPointerException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • spring data neo4j not lookup node
    via by Unknown author,
  • i set some value to my neo4jdb,an i can see them in web-browser,so my db have nodes.but when i look up them,it returns null.what is wrong?my spring data neo4j version is 3.2.2.thanks for help,i have in disturbing with this four a long time {code} package com.oberon.fm.neo4j.service; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Transaction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.neo4j.support.Neo4jTemplate; import org.springframework.data.neo4j.template.Neo4jOperations; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.oberon.fm.domain.Movie; import com.oberon.fm.domain.User; @Service public class DatabasePopulator { @Autowired Neo4jOperations operation; @Autowired Neo4jTemplate template; private final static Logger log = LoggerFactory .getLogger(DatabasePopulator.class); @Transactional public void populateWithSomeTestData() { System.out.println("==== Populating ===="); GraphDatabaseService graphDb = template.getGraphDatabaseService(); Transaction tx = graphDb.beginTx(); try { User user = new User("micha", "Micha", "password", User.Roles.ROLE_USER); User me = template.save(user); User yang = template.save(new User("yang", "Yang", "password", User.Roles.ROLE_USER)); User ollie = template.save(new User("ollie", "Olliver", "password", User.Roles.ROLE_USER)); me.addFriend(ollie); // id and title Movie forrestGump = template.save(new Movie("1", "Forrest Gump")); me.rate(template, forrestGump, 5, "Best of the series"); tx.success(); String name = me.getName(); log.debug(name); } catch (Exception e) { e.printStackTrace(); } finally { tx.close(); System.out.println("==== endPopulating ===="); } } @Transactional public void cleanDb() { new Neo4jDatabaseCleaner(template).cleanDb(); } public boolean loginCheck(String userName, String password) { boolean rtn = false; GraphDatabaseService graphDb = template.getGraphDatabaseService(); Transaction tx = graphDb.beginTx(); try { User test = operation.lookup(User.class, "name", userName) .to(User.class).singleOrNull(); System.out.println("2" + test); User loginUser = template.lookup(User.class, "name", userName) .to(User.class).singleOrNull(); System.out.println("3" + loginUser); String userPassword = loginUser.getPassword(); System.out.println(userPassword); if (new Md5PasswordEncoder().encodePassword(password, User.SALT) .equals(userPassword)) { rtn = true; } tx.success(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { tx.close(); } return rtn; } {code} {code} error info 2null 3null java.lang.NullPointerException at com.oberon.fm.neo4j.service.DatabasePopulator.loginCheck(DatabasePopulator.java:86) at com.oberon.fm.neo4j.service.DatabasePopulator$$FastClassBySpringCGLIB$$c9138765.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649) at com.oberon.fm.neo4j.service.DatabasePopulator$$EnhancerBySpringCGLIB$$27698688.loginCheck(<generated>) at com.oberon.fm.controller.AuthController.loginCheck(AuthController.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code}
    via by yangjun,
  • i set some value to my neo4jdb,an i can see them in web-browser,so my db have nodes.but when i look up them,it returns null.what is wrong?my spring data neo4j version is 3.2.2.thanks for help,i have in disturbing with this four a long time {code} package com.oberon.fm.neo4j.service; import org.neo4j.graphdb.GraphDatabaseService; import org.neo4j.graphdb.Transaction; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.neo4j.support.Neo4jTemplate; import org.springframework.data.neo4j.template.Neo4jOperations; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.oberon.fm.domain.Movie; import com.oberon.fm.domain.User; @Service public class DatabasePopulator { @Autowired Neo4jOperations operation; @Autowired Neo4jTemplate template; private final static Logger log = LoggerFactory .getLogger(DatabasePopulator.class); @Transactional public void populateWithSomeTestData() { System.out.println("==== Populating ===="); GraphDatabaseService graphDb = template.getGraphDatabaseService(); Transaction tx = graphDb.beginTx(); try { User user = new User("micha", "Micha", "password", User.Roles.ROLE_USER); User me = template.save(user); User yang = template.save(new User("yang", "Yang", "password", User.Roles.ROLE_USER)); User ollie = template.save(new User("ollie", "Olliver", "password", User.Roles.ROLE_USER)); me.addFriend(ollie); // id and title Movie forrestGump = template.save(new Movie("1", "Forrest Gump")); me.rate(template, forrestGump, 5, "Best of the series"); tx.success(); String name = me.getName(); log.debug(name); } catch (Exception e) { e.printStackTrace(); } finally { tx.close(); System.out.println("==== endPopulating ===="); } } @Transactional public void cleanDb() { new Neo4jDatabaseCleaner(template).cleanDb(); } public boolean loginCheck(String userName, String password) { boolean rtn = false; GraphDatabaseService graphDb = template.getGraphDatabaseService(); Transaction tx = graphDb.beginTx(); try { User test = operation.lookup(User.class, "name", userName) .to(User.class).singleOrNull(); System.out.println("2" + test); User loginUser = template.lookup(User.class, "name", userName) .to(User.class).singleOrNull(); System.out.println("3" + loginUser); String userPassword = loginUser.getPassword(); System.out.println(userPassword); if (new Md5PasswordEncoder().encodePassword(password, User.SALT) .equals(userPassword)) { rtn = true; } tx.success(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { tx.close(); } return rtn; } {code} {code} error info 2null 3null java.lang.NullPointerException at com.oberon.fm.neo4j.service.DatabasePopulator.loginCheck(DatabasePopulator.java:86) at com.oberon.fm.neo4j.service.DatabasePopulator$$FastClassBySpringCGLIB$$c9138765.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649) at com.oberon.fm.neo4j.service.DatabasePopulator$$EnhancerBySpringCGLIB$$27698688.loginCheck(<generated>) at com.oberon.fm.controller.AuthController.loginCheck(AuthController.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745) {code}
    via by yangjun,
  • I can not get the session which i had set
    via by Unknown author,
    • java.lang.NullPointerException at com.oberon.fm.neo4j.service.DatabasePopulator.loginCheck(DatabasePopulator.java:86) at com.oberon.fm.neo4j.service.DatabasePopulator$$FastClassBySpringCGLIB$$c9138765.invoke(<generated>) at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:649) at com.oberon.fm.neo4j.service.DatabasePopulator$$EnhancerBySpringCGLIB$$27698688.loginCheck(<generated>) at com.oberon.fm.controller.AuthController.loginCheck(AuthController.java:41) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:483) at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:177) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:446) at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:434) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:943) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:877) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:966) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868) at javax.servlet.http.HttpServlet.service(HttpServlet.java:644) at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:842) at javax.servlet.http.HttpServlet.service(HttpServlet.java:725) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:291) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:239) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:219) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:610) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:537) at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1085) at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:658) at org.apache.coyote.http11.Http11NioProtocol$Http11ConnectionHandler.process(Http11NioProtocol.java:222) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1556) at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1513) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) at java.lang.Thread.run(Thread.java:745)
    No Bugmate found.