You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by t....@meje.org on 2008/12/05 13:09:04 UTC

hibernate session not bound

Hi all!

When using cxf for my webservices i got the following exception:

Caused by: org.hibernate.HibernateException: No Hibernate Session bound to
thread, and configuration does not allow creation of non-transactional one
here

I have a typical setup: spring-hibernate-cxf. I have configured a
opensessioninviewfilter as a hibernatefilter in my web.xml:

 <filter>
	<filter-name>HibernateFilter</filter-name>
	<filter-class>com.project.spring.filter.HibernateFilter</filter-class>
		<init-param>
			<param-name>sessionFactory</param-name>
			<param-value>hibernateTemplate</param-value>
		</init-param>
	</filter>
	<filter-mapping>
        <filter-name>HibernateFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

I have a client and an endpoint configured:

	<jaxws:endpoint 
	  	id="testServiceEndPoint" 
	  	implementor="#RemoteTestService"
	  	implementorClass="com.project.service.remote.RemoteTestServiceImpl"
	  	address="/RemoteAfsprakenService"/>
	
	<jaxws:client 
		id="remoteTestServiceClient" 
		serviceClass="com.project.service.remote.RemoteTestService" 
		address="http://localhost:8080/project/RemoteTestService" />

And I have the actual service configured:

	<bean id="RemoteTestService"
		class="com.project.service.remote.RemoteTestServiceImpl">
		<property name="testService" ref="testService" />
	</bean>

>From what I understand is that the Hibernate Filter is never used because
cxf uses local transport instead of http transport. If this is true 1. Can
I configure that and 2. How can create a filter for local transport.

Thanks,

Thijs Thiessens




Re: hibernate session not bound

Posted by Daniel Kulp <dk...@apache.org>.
> From what I understand is that the Hibernate Filter is never used because
> cxf uses local transport instead of http transport. If this is true 1. Can
> I configure that and 2. How can create a filter for local transport.

No.   CXF would only use a local transport if you tell it too.  Thus, that's 
probably not it.

Dan



On Friday 05 December 2008 7:09:04 am t.thiessens@meje.org wrote:
> Hi all!
>
> When using cxf for my webservices i got the following exception:
>
> Caused by: org.hibernate.HibernateException: No Hibernate Session bound to
> thread, and configuration does not allow creation of non-transactional one
> here
>
> I have a typical setup: spring-hibernate-cxf. I have configured a
> opensessioninviewfilter as a hibernatefilter in my web.xml:
>
>  <filter>
> 	<filter-name>HibernateFilter</filter-name>
> 	<filter-class>com.project.spring.filter.HibernateFilter</filter-class>
> 		<init-param>
> 			<param-name>sessionFactory</param-name>
> 			<param-value>hibernateTemplate</param-value>
> 		</init-param>
> 	</filter>
> 	<filter-mapping>
>         <filter-name>HibernateFilter</filter-name>
>         <url-pattern>/*</url-pattern>
>     </filter-mapping>
>
> I have a client and an endpoint configured:
>
> 	<jaxws:endpoint
> 	  	id="testServiceEndPoint"
> 	  	implementor="#RemoteTestService"
> 	  	implementorClass="com.project.service.remote.RemoteTestServiceImpl"
> 	  	address="/RemoteAfsprakenService"/>
>
> 	<jaxws:client
> 		id="remoteTestServiceClient"
> 		serviceClass="com.project.service.remote.RemoteTestService"
> 		address="http://localhost:8080/project/RemoteTestService" />
>
> And I have the actual service configured:
>
> 	<bean id="RemoteTestService"
> 		class="com.project.service.remote.RemoteTestServiceImpl">
> 		<property name="testService" ref="testService" />
> 	</bean>
>
> From what I understand is that the Hibernate Filter is never used because
> cxf uses local transport instead of http transport. If this is true 1. Can
> I configure that and 2. How can create a filter for local transport.
>
> Thanks,
>
> Thijs Thiessens



-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog