java.lang.NullPointerException: null

Stack Overflow | Leo | 4 months ago
  1. 0

    Spring @Transactional em.getDelegate sometimes return null

    Stack Overflow | 4 months ago | Leo
    java.lang.NullPointerException: null
  2. 0

    In our application we use EntityManager.Clear in a method annotated with @transactional although we know it's not best practice ( we'll remove the call to clear()). when performing the same operation in large scale (the operation is done on single element and not in a robust way), we get NullPointerException. stack trace: {code:java} java.lang.NullPointerException at org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:237) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.internalClear(SessionImpl.java:340) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.clear(SessionImpl.java:336) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.clear(AbstractEntityManagerImpl.java:1419) ~[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final] at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_60] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_60] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE] at com.sun.proxy.$Proxy79.clear(Unknown Source) ~[?:?] {code} the stack trace show that the the source of the call is our call to entityManager.clear().

    Hibernate JIRA | 9 months ago | Meytal
    java.lang.NullPointerException
  3. 0

    In our application we use EntityManager.Clear in a method annotated with @transactional although we know it's not best practice ( we'll remove the call to clear()). when performing the same operation in large scale (the operation is done on single element and not in a robust way), we get NullPointerException. stack trace: {code:java} java.lang.NullPointerException at org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:237) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.internalClear(SessionImpl.java:340) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.internal.SessionImpl.clear(SessionImpl.java:336) ~[hibernate-core-4.3.8.Final.jar:4.3.8.Final] at org.hibernate.jpa.spi.AbstractEntityManagerImpl.clear(AbstractEntityManagerImpl.java:1419) ~[hibernate-entitymanager-4.3.8.Final.jar:4.3.8.Final] at sun.reflect.GeneratedMethodAccessor178.invoke(Unknown Source) ~[?:?] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_60] at java.lang.reflect.Method.invoke(Method.java:497) ~[?:1.8.0_60] at org.springframework.orm.jpa.ExtendedEntityManagerCreator$ExtendedEntityManagerInvocationHandler.invoke(ExtendedEntityManagerCreator.java:344) ~[spring-orm-4.2.3.RELEASE.jar:4.2.3.RELEASE] at com.sun.proxy.$Proxy79.clear(Unknown Source) ~[?:?] {code} the stack trace show that the the source of the call is our call to entityManager.clear().

    Hibernate JIRA | 9 months ago | Meytal
    java.lang.NullPointerException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    HQL Exception (org.hibernate.dialect.Dialect$3)

    Stack Overflow | 4 years ago | Hari
    java.lang.NullPointerException: null

    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

      null

      at org.hibernate.engine.internal.StatefulPersistenceContext.clear()
    2. Hibernate
      SessionImpl.clear
      1. org.hibernate.engine.internal.StatefulPersistenceContext.clear(StatefulPersistenceContext.java:235)[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
      2. org.hibernate.internal.SessionImpl.internalClear(SessionImpl.java:395)[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
      3. org.hibernate.internal.SessionImpl.clear(SessionImpl.java:391)[hibernate-core-5.1.0.Final.jar:5.1.0.Final]
      3 frames
    3. com.ric.bill
      ChrgServ$$FastClassBySpringCGLIB$$67dcba28.invoke
      1. com.ric.bill.ChrgServ.save(ChrgServ.java:227)[classes/:na]
      2. com.ric.bill.ChrgServ$$FastClassBySpringCGLIB$$67dcba28.invoke(<generated>)[classes/:na]
      2 frames
    4. Spring Core
      MethodProxy.invoke
      1. org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)[spring-core-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      1 frame
    5. Spring AOP
      ReflectiveMethodInvocation.proceed
      1. org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2 frames
    6. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:99)[spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
      2. org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:281)[spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
      3. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)[spring-tx-4.2.5.RELEASE.jar:4.2.5.RELEASE]
      3 frames
    7. Spring AOP
      CglibAopProxy$DynamicAdvisedInterceptor.intercept
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2. org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)[spring-aop-4.3.2.RELEASE.jar:4.3.2.RELEASE]
      2 frames
    8. com.ric.bill
      BillServ.chrgAll
      1. com.ric.bill.ChrgServ$$EnhancerBySpringCGLIB$$b101e62c.save(<generated>)[classes/:na]
      2. com.ric.bill.BillServ.chrgHouse(BillServ.java:121)[classes/:na]
      3. com.ric.bill.BillServ.chrgAll(BillServ.java:88)[classes/:na]
      3 frames
    9. com.ric.web
      GreetingController.greeting
      1. com.ric.web.GreetingController.greeting(GreetingController.java:81)[classes/:na]
      1 frame
    10. Java RT
      Method.invoke
      1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)[na:1.8.0_60]
      2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)[na:1.8.0_60]
      3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)[na:1.8.0_60]
      4. java.lang.reflect.Method.invoke(Method.java:497)[na:1.8.0_60]
      4 frames