Problem with WSF Spring and Hibernate

llafragua.hotmail.com's picture

Hi:

I am developing a web project in eclipse with the WSF Spring framework, hibernate and java annotations, the share of integacion of axis2 and spring working properly, but my webservices I need to bring data from a database, for this coupling support from spring to hibernate in my applicationContext.xml as follows:

<import resource="dao-Context.xml"/> 

where my dao-context.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>

<!-- DATASOURCE DEFINITON-->

<beans xmlns="http://www.springframework.org/schema/beans"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://www.springframework.org/schema/beans

http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">

<bean id="dataSource"

class="org.springframework.jdbc.datasource.DriverManagerDataSource">

<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver" />

<property name="url" value="jdbc:oracle:thin:@10.20.16.119:1521:cofetel" />

<property name="username" value="COFETEL" />

<property name="password" value="admin" />

</bean>

<!-- HIBERNATE CONFIGURATION -->

<bean id="sessionFactory"

class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">

<property name="dataSource" ref="dataSource" />

<property name="annotatedClasses">

<list>

<value>gob.cofetel.arquitectura.domain.CaEmpresa</value>

</list>

</property>

<property name="hibernateProperties">

<props>

<prop key="hibernate.dialect">

org.hibernate.dialect.Oracle9Dialect

</prop>

<prop key="hibernate.show_sql">true</prop>

<prop key="hibernate.use_outer_join">true</prop>

<prop key="hibernate.max_fetch_depth">1</prop>

<prop key="hibernate.jdbc.batch_size">0</prop>

<prop key="hibernate.default_schema">COFETEL</prop>

<prop key="hibernate.hbm2ddl.auto"> update</prop>

</props>

</property>

</bean>

</beans>

 

 

<?xml version="1.0" encoding="UTF-8"?>

  The web project compiles and displays on a tomcat6 I can see the wsdl, but when trying to insert a data in the database, the tomcat throws me the following exception:

 

No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.AbstractSessionFactoryBean$TransactionAwareInvocationHandler.invoke(AbstractSessionFactoryBean.java:300) at $Proxy8.getCurrentSession(Unknown Source) at gob.cofetel.arquitectura.dao.GenericDaoImpl.getSession(GenericDaoImpl.java:31) at gob.cofetel.arquitectura.dao.GenericDaoImpl.makePersistent(GenericDaoImpl.java:25) at gob.cofetel.arquitectura.service.impl.EmpresaServiceImpl.agregarEmpresa(EmpresaServiceImpl.java:53) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:194) at org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver.invokeBusinessLogic(RPCInOnlyMessageReceiver.java:63) at org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.util.RESTUtil.invokeAxisEngine(RESTUtil.java:136) at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil.java:130) at org.apache.axis2.transport.http.AxisServlet$RestRequestProcessor.processURLRequest(AxisServlet.java:829) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:255) at javax.servlet.http.HttpServlet.service(HttpServlet.java:617) at javax.servlet.http.HttpServlet.service(HttpServlet.java:717) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454) at java.lang.Thread.run(Unknown Source)

any ideas? Thanks and Regards.
library project main code
Learn Cloud
Learn
Cloud

The WSO2 Application Server is a reliable application server that can host your enterprise web applications. The WSO2 Application Server as a Service is offered in StratosLive, the WSO2 Platform as a Service. This article explains how a simple web application can be developed and deployed from Carbon Studio to the WSO2 Application Server...

Latest Webinar
Different groups within an organization need to monitor different Key Performance Indicators (KPIs) - An operations team will be interested in the response times of business services and loads of each service,..
Thursday, February 9th 2012, 09.00 AM (PST)

Thursday, February 9th 2012, 10.00 AM (GMT)