Results 1 to 3 of 3

Thread: Hibernate + glassfish + JTA = freeze

  1. #1
    Join Date
    Feb 2009
    Location
    France
    Posts
    22

    Unhappy 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Feb 2009
    Location
    France
    Posts
    22

    Default

    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

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •