You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Alex <de...@gmail.com> on 2010/02/03 10:36:49 UTC

Tomcat, CXF and Hibernate

Hi out there,

I'm want to set up a CXF 2.2.6 webservice with persistence using 
hibernate on a tomcat 6.0.24.

my setup, please take a look at the attached files.

The same configuration work fine without CXF, I dont' know how to set up 
this with CXF context, and wehre the problem is.

..
INFO ;2010-02-03 
10:30:46,578;org.hibernate.impl.SessionFactoryObjectFactory;;Factory 
name: MyHibernateSession
INFO ;2010-02-03 10:30:46,578;org.hibernate.util.NamingHelper;;JNDI 
InitialContext properties:{}
INFO ;2010-02-03 
10:30:46,578;org.hibernate.impl.SessionFactoryObjectFactory;;Bound 
factory to JNDI name: MyHibernateSession
WARN ;2010-02-03 
10:30:46,578;org.hibernate.impl.SessionFactoryObjectFactory;;InitialContext 
did not implement EventContext
INFO ;2010-02-03 
10:30:46,610;org.springframework.web.context.ContextLoader;;Root 
WebApplicationContext: initialization started
INFO ;2010-02-03 
10:30:46,633;org.springframework.web.context.support.XmlWebApplicationContext;;Refreshing 
org.springframework.web.context.support.XmlWebApplicationContext@3f56e5ed: 
display name [Root WebApplicationContext]; startup date [Wed Feb 03 
10:30:46 CET 2010]; root of context hierarchy
INFO ;2010-02-03 
10:30:46,668;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
XML bean definitions from ServletContext resource 
[/WEB-INF/applicationContext.xml]
INFO ;2010-02-03 
10:30:46,737;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
INFO ;2010-02-03 
10:30:46,800;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
XML bean definitions from class path resource 
[META-INF/cxf/cxf-extension-soap.xml]
INFO ;2010-02-03 
10:30:46,820;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]
INFO ;2010-02-03 
10:30:46,868;org.springframework.web.context.support.XmlWebApplicationContext;;Bean 
factory for application context 
[org.springframework.web.context.support.XmlWebApplicationContext@3f56e5ed]: 
org.springframework.beans.factory.support.DefaultListableBeanFactory@7d59ea8e
INFO ;2010-02-03 
10:30:46,966;org.springframework.beans.factory.support.DefaultListableBeanFactory;;Pre-instantiating 
singletons in 
org.springframework.beans.factory.support.DefaultListableBeanFactory@7d59ea8e: 
defining beans 
[cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,MyService]; 
root of factory hierarchy
INFO ;2010-02-03 
10:30:48,367;org.springframework.web.context.ContextLoader;;Root 
WebApplicationContext: initialization completed in 1757 ms
INFO ;2010-02-03 
10:30:48,381;org.apache.cxf.bus.spring.BusApplicationContext;;Refreshing 
org.apache.cxf.bus.spring.BusApplicationContext@1259b924: display name 
[org.apache.cxf.bus.spring.BusApplicationContext@1259b924]; startup date 
[Wed Feb 03 10:30:48 CET 2010]; parent: 
org.springframework.web.context.support.XmlWebApplicationContext@3f56e5ed
INFO ;2010-02-03 
10:30:48,390;org.apache.cxf.bus.spring.BusApplicationContext;;Bean 
factory for application context 
[org.apache.cxf.bus.spring.BusApplicationContext@1259b924]: 
org.springframework.beans.factory.support.DefaultListableBeanFactory@15357784
INFO ;2010-02-03 
10:30:48,390;org.springframework.beans.factory.support.DefaultListableBeanFactory;;Pre-instantiating 
singletons in 
org.springframework.beans.factory.support.DefaultListableBeanFactory@15357784: 
defining beans []; parent: 
org.springframework.beans.factory.support.DefaultListableBeanFactory@7d59ea8e
ERROR;2010-02-03 10:30:50,847;myservice.db.dao.CostumerHome;;Could not 
locate SessionFactory in JNDI
javax.naming.NameNotFoundException: Name MyHibernateSession is not bound 
in this Context
...

I searched the net but I didn't found any related, so I hope you can 
help me.

Best regards Alex.

Re: Tomcat, CXF and Hibernate

Posted by Alex <de...@gmail.com>.
Hi,

I have found another solution, I configure hibernate via spring.

In my web.xml I added a additional hibernateContext.xml, but now I run 
into the problem that I could not
found any ApplicationContext from which I can access my dao-bean classes.

Is there a Interface which I have to Implement?

Thanks, Alex


Alex schrieb:
> Hi out there,
>
> I'm want to set up a CXF 2.2.6 webservice with persistence using 
> hibernate on a tomcat 6.0.24.
>
> my setup, please take a look at the attached files.
>
> The same configuration work fine without CXF, I dont' know how to set 
> up this with CXF context, and wehre the problem is.
>
> ..
> INFO ;2010-02-03 
> 10:30:46,578;org.hibernate.impl.SessionFactoryObjectFactory;;Factory 
> name: MyHibernateSession
> INFO ;2010-02-03 10:30:46,578;org.hibernate.util.NamingHelper;;JNDI 
> InitialContext properties:{}
> INFO ;2010-02-03 
> 10:30:46,578;org.hibernate.impl.SessionFactoryObjectFactory;;Bound 
> factory to JNDI name: MyHibernateSession
> WARN ;2010-02-03 
> 10:30:46,578;org.hibernate.impl.SessionFactoryObjectFactory;;InitialContext 
> did not implement EventContext
> INFO ;2010-02-03 
> 10:30:46,610;org.springframework.web.context.ContextLoader;;Root 
> WebApplicationContext: initialization started
> INFO ;2010-02-03 
> 10:30:46,633;org.springframework.web.context.support.XmlWebApplicationContext;;Refreshing 
> org.springframework.web.context.support.XmlWebApplicationContext@3f56e5ed: 
> display name [Root WebApplicationContext]; startup date [Wed Feb 03 
> 10:30:46 CET 2010]; root of context hierarchy
> INFO ;2010-02-03 
> 10:30:46,668;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
> XML bean definitions from ServletContext resource 
> [/WEB-INF/applicationContext.xml]
> INFO ;2010-02-03 
> 10:30:46,737;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
> XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
> INFO ;2010-02-03 
> 10:30:46,800;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
> XML bean definitions from class path resource 
> [META-INF/cxf/cxf-extension-soap.xml]
> INFO ;2010-02-03 
> 10:30:46,820;org.springframework.beans.factory.xml.XmlBeanDefinitionReader;;Loading 
> XML bean definitions from class path resource 
> [META-INF/cxf/cxf-servlet.xml]
> INFO ;2010-02-03 
> 10:30:46,868;org.springframework.web.context.support.XmlWebApplicationContext;;Bean 
> factory for application context 
> [org.springframework.web.context.support.XmlWebApplicationContext@3f56e5ed]: 
> org.springframework.beans.factory.support.DefaultListableBeanFactory@7d59ea8e 
>
> INFO ;2010-02-03 
> 10:30:46,966;org.springframework.beans.factory.support.DefaultListableBeanFactory;;Pre-instantiating 
> singletons in 
> org.springframework.beans.factory.support.DefaultListableBeanFactory@7d59ea8e: 
> defining beans 
> [cxf,org.apache.cxf.bus.spring.BusApplicationListener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.spring.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.cxf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding.BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.transport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.PhaseManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycleManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleManager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHandlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.HeaderManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContractResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.soap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf.transport.servlet.ServletTransportFactory,MyService]; 
> root of factory hierarchy
> INFO ;2010-02-03 
> 10:30:48,367;org.springframework.web.context.ContextLoader;;Root 
> WebApplicationContext: initialization completed in 1757 ms
> INFO ;2010-02-03 
> 10:30:48,381;org.apache.cxf.bus.spring.BusApplicationContext;;Refreshing 
> org.apache.cxf.bus.spring.BusApplicationContext@1259b924: display name 
> [org.apache.cxf.bus.spring.BusApplicationContext@1259b924]; startup 
> date [Wed Feb 03 10:30:48 CET 2010]; parent: 
> org.springframework.web.context.support.XmlWebApplicationContext@3f56e5ed
> INFO ;2010-02-03 
> 10:30:48,390;org.apache.cxf.bus.spring.BusApplicationContext;;Bean 
> factory for application context 
> [org.apache.cxf.bus.spring.BusApplicationContext@1259b924]: 
> org.springframework.beans.factory.support.DefaultListableBeanFactory@15357784 
>
> INFO ;2010-02-03 
> 10:30:48,390;org.springframework.beans.factory.support.DefaultListableBeanFactory;;Pre-instantiating 
> singletons in 
> org.springframework.beans.factory.support.DefaultListableBeanFactory@15357784: 
> defining beans []; parent: 
> org.springframework.beans.factory.support.DefaultListableBeanFactory@7d59ea8e 
>
> ERROR;2010-02-03 10:30:50,847;myservice.db.dao.CostumerHome;;Could not 
> locate SessionFactory in JNDI
> javax.naming.NameNotFoundException: Name MyHibernateSession is not 
> bound in this Context
> ...
>
> I searched the net but I didn't found any related, so I hope you can 
> help me.
>
> Best regards Alex.