java.lang.NullPointerException

Spring JIRA | Victor | 1 decade 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

    Today I just tried to upgrade the spring lib to 1.1 rc2 from 1.02. To my surprise, the JTA starts to fail after I replaced the old spring.jar. After I switch back to 1.02, everything works again (no code change). I use spring in within SLSB CMT which is demarcated as Required, tx attribute of the spring interceptted method is PROPAGATION_REQUIRES_NEW. The call failed no matter there is a tx started by the ejb client or not. Here is the error I got with 1.1 rc2: [8/19/04 18:46:57:109 EDT] 52f8054b SystemOut U ERROR [ORB.thread.pool:2] (AbstractPlatformTransactionManager.java:521) - Rollback exception overridden by synchronization exception java.lang.NullPointerException at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCommit(SessionFactoryUtils.java:620) at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:500) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:364) at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:241) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:66) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy0.logInboundRequest(Unknown Source) at [8/19/04 18:46:57:109 EDT] 52f8054b JTSXA W Current thread is already associated with another transaction. I took a look at the source and found the session object is null after executing the following line in SessionFactoryUtils. Session session = (this.jtaTransaction != null) ? this.sessionHolder.getSession(this.jtaTransaction) : this.sessionHolder.getSession(); While during the whole debug tracing, all session objects seem to bound use the DEFAULT_KEY - which is just a blank object. I'm using spring's JtaTransactionManager to set the TransactionManagerLookup, maybe there are some additional steps needed in this new version?

    Spring JIRA | 1 decade ago | Victor
    java.lang.NullPointerException
  2. 0

    Today I just tried to upgrade the spring lib to 1.1 rc2 from 1.02. To my surprise, the JTA starts to fail after I replaced the old spring.jar. After I switch back to 1.02, everything works again (no code change). I use spring in within SLSB CMT which is demarcated as Required, tx attribute of the spring interceptted method is PROPAGATION_REQUIRES_NEW. The call failed no matter there is a tx started by the ejb client or not. Here is the error I got with 1.1 rc2: [8/19/04 18:46:57:109 EDT] 52f8054b SystemOut U ERROR [ORB.thread.pool:2] (AbstractPlatformTransactionManager.java:521) - Rollback exception overridden by synchronization exception java.lang.NullPointerException at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCommit(SessionFactoryUtils.java:620) at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:500) at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:364) at org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:241) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:66) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152) at $Proxy0.logInboundRequest(Unknown Source) at [8/19/04 18:46:57:109 EDT] 52f8054b JTSXA W Current thread is already associated with another transaction. I took a look at the source and found the session object is null after executing the following line in SessionFactoryUtils. Session session = (this.jtaTransaction != null) ? this.sessionHolder.getSession(this.jtaTransaction) : this.sessionHolder.getSession(); While during the whole debug tracing, all session objects seem to bound use the DEFAULT_KEY - which is just a blank object. I'm using spring's JtaTransactionManager to set the TransactionManagerLookup, maybe there are some additional steps needed in this new version?

    Spring JIRA | 1 decade ago | Victor
    java.lang.NullPointerException

    Root Cause Analysis

    1. java.lang.NullPointerException

      No message provided

      at org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCommit()
    2. Hibernate
      SessionFactoryUtils$SpringSessionSynchronization.beforeCommit
      1. org.springframework.orm.hibernate.SessionFactoryUtils$SpringSessionSynchronization.beforeCommit(SessionFactoryUtils.java:620)
      1 frame
    3. Spring Tx
      TransactionInterceptor.invoke
      1. org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:500)
      2. org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:364)
      3. org.springframework.transaction.interceptor.TransactionAspectSupport.doCommitTransactionAfterReturning(TransactionAspectSupport.java:241)
      4. org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:66)
      4 frames
    4. Spring AOP
      JdkDynamicAopProxy.invoke
      1. org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:139)
      2. org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:152)
      2 frames
    5. Unknown
      $Proxy0.logInboundRequest
      1. $Proxy0.logInboundRequest(Unknown Source)
      1 frame