Announcement Announcement Module
Collapse
No announcement yet.
Hibernate + glassfish + JTA = freeze Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Hibernate + glassfish + JTA = freeze

    Hi,

    I'm trying to deploy an webapp on glassfish 3.0.1.

    It use spring 3.0.5.

    Originally it works on tomcat with spring hibernate local transation factory.
    As Glassfish is a full JEE server, I'm trying to use JtaTransactionManager

    Under tomcat, my configuration is :
    Code:
    <bean id="sessionFactory"
    		class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    		<property name="configLocation" value="classpath:jbpm.hibernate.cfg.xml" />
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    
    	<bean id="hibernateTemplate" class="org.springframework.orm.hibernate3.HibernateTemplate">
    		<property name="sessionFactory" ref="sessionFactory"></property>
    	</bean>
    
    	<bean id="transactionManager"
    		class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    		<property name="sessionFactory" ref="sessionFactory" />
    		<property name="dataSource" ref="dataSource" />
    	</bean>
    
            <tx:annotation-driven/>
    
    	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
    		destroy-method="close">
    		<property name="driverClass" value="${jdbc.driverClassName}" />
    		<property name="jdbcUrl" value="${jdbc.url}" />
    		<property name="user" value="${jdbc.username}" />
    		<property name="password" value="${jdbc.password}" />
                    <property name="initialPoolSize" value="4"/>
                    <property name="maxPoolSize" value="30"/>
                    <property name="idleConnectionTestPeriod" value="3600"/>
    	</bean>
    I just change the transaction manager to
    Code:
    <bean id="transactionManager"
    		class="org.springframework.transaction.jta.JtaTransactionManager">
    	</bean>
    But hibernate is freezing when loading sessionFactory !

    Do I missed something ?

    Regards

  • #2
    1 question... Why... Do you need xa transactions, do you need distributed transactions? If not don't use a jta transaction manager it makes things (in general) more complex then needed.

    Anyways... For starters use tx:jta-transaction-manager instead of JtaTransactionManager... Next to that post your hibernate configuration and make sure that you configured hibernate for jta transactions.

    Comment


    • #3
      You are right, I don't need any XA transaction...

      I had parameter hibernate.transaction.factory_class to define JTA transaction factory in hibernate configuration file :
      Code:
      <hibernate-configuration>
        <session-factory>
          <property name="hibernate.format_sql">false</property>
          <property name="hibernate.show_sql">true</property>
          <property name="hibernate.hbm2ddl.auto">update</property>
      <property name="hibernate.transaction.factory_class">org.hibernate.transaction.JTATransactionFactory</property>
          ... Here all my mapping files...
          
        </session-factory>
      I put <tx:jta-transaction-manager> instead of declaration of the bean transactionManager, but no better success !

      regards

      Comment

      Working...
      X