java.lang.NullPointerException

Stack Overflow | marcin | 3 months ago
  1. 0

    NullPointerException while loading data from Neo4j database with OGM driver

    Stack Overflow | 3 months ago | marcin
    java.lang.NullPointerException
  2. 0

    neo4j in JEE (JBoss) environment:

    Stack Overflow | 1 year ago | michaeak
    org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException
  3. 0

    Optional<T> is not recognized as a valid return type of a repository method (where T denotes an entity type). The stack trace becomes as follows: {code} java.lang.NullPointerException at org.neo4j.ogm.metadata.MetaData.entityType(MetaData.java:231) at org.neo4j.ogm.session.Neo4jSession.entityType(Neo4jSession.java:451) at org.neo4j.ogm.session.delegates.LoadByTypeDelegate.loadAll(LoadByTypeDelegate.java:55) at org.neo4j.ogm.session.delegates.LoadByTypeDelegate.loadAll(LoadByTypeDelegate.java:144) at org.neo4j.ogm.session.Neo4jSession.loadAll(Neo4jSession.java:193) at org.springframework.data.neo4j.repository.query.derived.DerivedGraphRepositoryQuery.execute(DerivedGraphRepositoryQuery.java:64) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:454) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:432) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207) at com.sun.proxy.$Proxy103.findByLogin(Unknown Source) {code} with a simple SDN interface such as : {code} public interface UserRepository extends GraphRepository<User> { Optional<User> findByLogin(String login); } {code}

    Spring JIRA | 1 year ago | Florent Biville
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    In repository interface When defining deleteBy...<AttributeName> method if the return type is not the Repository entity type... NullPointerExceptions are thrown. spring-data-neo4j 4.0.0.RELEASE neo4j-ogm 1.1.4 {panel:title=Work around is to use:} _public *SimpleGraphNode* deleteBySessionId(String sessionId);_ {panel} but I think it should be flexible enough to use void, Long, or Boolean... and it should *definitely NOT* throw NullPointerExceptions. {code:java} package YOUR.ROOT.PACKAGE.web.test.neo4j.bug; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.neo4j.ogm.session.Session; import org.neo4j.ogm.session.SessionFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.neo4j.config.Neo4jConfiguration; import org.springframework.data.neo4j.repository.config.EnableNeo4jRepositories; import org.springframework.data.neo4j.server.InProcessServer; import org.springframework.data.neo4j.server.Neo4jServer; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration public class SpringDataNeo4jDeleteByBugReplicateTest { @Autowired private SimpleGraphNodeRepository repository; private SimpleGraphNode sgn = new SimpleGraphNode(); private final String sessionId = "123456"; @Before public void setup() { sgn.setSessionId(sessionId); repository.save(sgn); } @Test public void willThrowNullPointExceptionWhenDeletingBySessionIdAttribute() throws Exception { repository.deleteBySessionId(sessionId); } @Configuration @EnableNeo4jRepositories(basePackages={"YOUR.ROOT.PACKAGE..web.test.neo4j.bug"}) //@ComponentScan(basePackages={"YOUR.ROOT.PACKAGE..web.test.neo4j.bug"}) public static class BugReplicateTestConfig extends Neo4jConfiguration{ @Bean public Session getSession() throws Exception { return super.getSession(); } @Override public Neo4jServer neo4jServer() { return new InProcessServer(); } @Override public SessionFactory getSessionFactory() { return new SessionFactory( "YOUR.ROOT.PACKAGE..web.test.neo4j.bug" ); } } } {code} {code:java} package YOUR.ROOT.PACKAGE..web.test.neo4j.bug; import org.springframework.data.neo4j.repository.GraphRepository; public interface SimpleGraphNodeRepository extends GraphRepository<SimpleGraphNode> { //public void deleteBySessionId(String sessionId); // Throws NullPointerException //public SimpleGraphNode deleteBySessionId(String sessionId); // WORKS! //public Boolean deleteBySessionId(String sessionId); // Throws NullPointerException public Long deleteBySessionId(String sessionId); // Throws NullPointerException } {code} {code:java} package YOUR.ROOT.PACKAGE..web.test.neo4j.bug; import org.neo4j.ogm.annotation.GraphId; import org.neo4j.ogm.annotation.NodeEntity; @NodeEntity public class SimpleGraphNode { @GraphId private Long id; private String sessionId; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getSessionId() { return sessionId; } public void setSessionId(String sessionId) { this.sessionId = sessionId; } } {code} {noformat} java.lang.NullPointerException at org.neo4j.ogm.metadata.MetaData.entityType(MetaData.java:265) at org.neo4j.ogm.session.Neo4jSession.entityType(Neo4jSession.java:451) at org.neo4j.ogm.session.delegates.LoadByTypeDelegate.loadAll(LoadByTypeDelegate.java:55) at org.neo4j.ogm.session.delegates.LoadByTypeDelegate.loadAll(LoadByTypeDelegate.java:144) at org.neo4j.ogm.session.Neo4jSession.loadAll(Neo4jSession.java:193) at org.springframework.data.neo4j.repository.query.derived.DerivedGraphRepositoryQuery.execute(DerivedGraphRepositoryQuery.java:64) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.doInvoke(RepositoryFactorySupport.java:462) at org.springframework.data.repository.core.support.RepositoryFactorySupport$QueryExecutorMethodInterceptor.invoke(RepositoryFactorySupport.java:440) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.data.projection.DefaultMethodInvokingMethodInterceptor.invoke(DefaultMethodInvokingMethodInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99) at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.dao.support.PersistenceExceptionTranslationInterceptor.invoke(PersistenceExceptionTranslationInterceptor.java:136) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208) at com.sun.proxy.$Proxy87.deleteBySessionId(Unknown Source) at com.gggdw.web.test.neo4j.bug.SpringDataNeo4jDeleteByBugReplicateTest.willThrowNullPointExceptionWhenDeletingBySessionIdAttribute(SpringDataNeo4jDeleteByBugReplicateTest.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.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:363) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192) {noformat}

    Spring JIRA | 10 months ago | Selwyn Jacobs
    java.lang.NullPointerException

    1 unregistered visitors
    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.neo4j.ogm.MetaData.entityType()
    2. org.neo4j.ogm
      Neo4jSession.loadAll
      1. org.neo4j.ogm.MetaData.entityType(MetaData.java:280)
      2. org.neo4j.ogm.session.Neo4jSession.entityType(Neo4jSession.java:486)
      3. org.neo4j.ogm.session.delegates.LoadByTypeDelegate.loadAll(LoadByTypeDelegate.java:60)
      4. org.neo4j.ogm.session.delegates.LoadByTypeDelegate.loadAll(LoadByTypeDelegate.java:108)
      5. org.neo4j.ogm.session.Neo4jSession.loadAll(Neo4jSession.java:152)
      5 frames
    3. neo4jCMS
      Application.main
      1. neo4jCMS.TestSite.run(TestSite.java:35)
      2. neo4jCMS.Application.main(Application.java:20)
      2 frames