-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Hibernate works but not when deployed on tomcat
PostPosted: Fri Apr 13, 2012 11:39 am 
Newbie

Joined: Wed Jun 01, 2011 12:34 pm
Posts: 7
I got a method that uses hibernate to connect to DB and retrieve the data. The method works fine when executed as standalone java app. However when I try to deploy it on tomcat and invoke as a web service I get an error as below. My method is the first and the only place where DB connection is being established, i.e. I'm not defining any datasources within tomcat.

Code:
No Hibernate Session bound to thread, and configuration does not allow creation
of non-transactional one here
at
org.springframework.orm.hibernate3.LocalSessionFactoryBean$TransactionAwareInvocationHandler.invoke(LocalSessionFactoryBean.


My hibernate config file:
Code:
<bean id="mySessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
    <property name="dataSource" ref="myDataSource" />
    <property name="exposeTransactionAwareSessionFactory" value="true" />
    <property name="hibernateProperties">
        <props>
            <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
            <prop key="hibernate.show_sql">true</prop>
            <prop key="hibernate.hbm2ddl.auto">none</prop>
            <prop key="hibernate.statement_cache.size">10</prop>
            <prop key="hibernate.c3p0.min_size">1</prop>               
            <prop key="hibernate.c3p0.max_size">10</prop>
            <prop key="hibernate.connection.autocommit">false</prop>
            <prop key="hibernate.default_schema">${mydbSchema}</prop>
            <prop key="hibernate.current_session_context_class">thread</prop>       
            <prop key="hibernate.transaction.manager_lookup_class">com.atomikos.icatch.jta.hibernate3.TransactionManagerLookup</prop>               
        </props>
    </property>
</bean>


I'm using the following hibernate modules:
hibernate-annotations 3.4.0.GA
hibernate-core 3.3.1.GA
hibernate 3.2.6.ga
hibernate-commons-annotations 3.1.0.GA


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.