Nullpointer in hibernate will start a transaction

I am using hibernate with datasource pool connected

<bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource"  destroy-method="close">
            <property name="connectionCachingEnabled" value="true" />
        <property name="URL">
            <value>${jdbc.url}</value>
        </property>
        <property name="user">
            <value>${jdbc.username}</value>
        </property>
        <property name="password">
            <value>${jdbc.password}</value>
        </property>
        <property name="connectionCacheProperties">
          <value>
            MinLimit:10
            MaxLimit:75
            InitialLimit:10
            ConnectionWaitTimeout:120
            InactivityTimeout:180
            ValidateConnection:true
            MaxStatementsLimit:0
          </value>
       </property>
    </bean>



<bean id="hibernatePropertyConfigurer"
      class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="hibernate.properties"/>
</bean>

<!-- Database Property -->
<bean id="hibernatePropertiesPearl"
      class="org.springframework.beans.factory.config.PropertiesFactoryBean">
    <property name="properties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.Oracle9Dialect</prop>
            <prop key="hibernate.cache.provider_class">MyCacheProvider</prop>
            <prop key="hibernate.show_sql">false</prop>
            <prop key="hibernate.max_fetch_depth">0</prop>
            <prop key="hibernate.jdbc.batch_size">0</prop>
            <prop key="hibernate.cache.use_query_cache">true</prop>
            <prop key="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory
            </prop>
            <prop key="hibernate.connection.autocommit">false</prop>
            <prop key="hibernate.transaction.manager_lookup_class">
                org.hibernate.transaction.JBossTransactionManagerLookup
            </prop>
            <prop key="hibernate.transaction.factory_class">org.hibernate.transaction.JDBCTransactionFactory</prop>
            <prop key="hibernate.transaction.auto_close_session">false</prop>
        </props>
    </property>
</bean>

            

I see that the connections open successfully in the database and work fine, but after a while I get the following error message in the logs and the server just dies:

 21:48:20,700 ERROR [RentalAgreementServlet] Generic exception occurred
 java.lang.NullPointerException
    at org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:85)
    at org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1354)
    at HibernateUtil.currentSession(HibernateUtil.java:116)

The number of connections in the database looks normal. Maximum 75, but almost never exceeds 20. The application is deployed in JBOSS 4.2. It seems that memory is also normal when a nullpointer operation is performed. It seems to me that something is leaking, but I do not know what. Is it possible that the connection pool believes that it has 75 sessions and is trying to increase it - at the same time there are only 20 connections on the db server?

. / , . , nullpointer. - , , ?

+5
2

, , finally. hibernate-, .

+1

, org.hibernate.transaction.JDBCTransactionFactory JTA.

, org.hibernate.transaction.JTATransactionFactory:

<prop key="hibernate.transaction.factory_class">
    org.hibernate.transaction.JTATransactionFactory
</prop>
+2

All Articles