cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Diego Xu <xubi...@net-2com.com.cn>
Subject Re: [jira] Commented: (CXF-794) Hibernate + Spring = Crashing (for me)
Date Mon, 06 Aug 2007 08:45:41 GMT

I encountered same problem as well,  and i suppose there maybe some
sollutions for it that we don't know jet.
is there any posiblelity that we could stop the Spring Injection method(i
mean, the setters spring used to inject bean fields) from been binded to xml
from JAXB? coz most of the times, those methord will carry some params of
interfaces, and witch more, we don't need them to be binded - we only need
the methods which were definded in the published interface to be binded.

anybody help again?



Glen Mazza-2 wrote:
> 
> How difficult would it be for CXF to return a user-friendly error
> message if that is the case (i.e., attempting to bind to an interface)?
> 
> Glen
> 
> 
> Am Dienstag, den 17.07.2007, 14:24 -0700 schrieb Dan Diephouse (JIRA):
> 
>> [
>> https://issues.apache.org/jira/browse/CXF-794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12513365
>> ] 
>> 
>> Dan Diephouse commented on CXF-794:
>> -----------------------------------
>> 
>> Now I'm just guess, but is User an interface? I would try using the Aegis
>> databinding if thats the case as JAXB can't handle interfaces. 
>> 
>> > Hibernate + Spring = Crashing (for me)
>> > --------------------------------------
>> >
>> >                 Key: CXF-794
>> >                 URL: https://issues.apache.org/jira/browse/CXF-794
>> >             Project: CXF
>> >          Issue Type: Bug
>> >    Affects Versions: 2.0
>> >         Environment: Apache Tomcat 5.5.23
>> > Spring 2.0.5
>> > Windows XP
>> >            Reporter: Cyrus Amiri
>> >
>> > Evaluating CXF as an alternative to the overengineered Axis2 project...
>> > Constructed the CXF servlet as described in the spring section of the
>> Users Guide
>> > Created a test service: 
>> > IServiceTest.java
>> > package com.novaleaf.kauri.serviceinterfaces;
>> > import javax.jws.WebService;
>> > @WebService
>> > public interface IServiceTest
>> > {
>> > 	public int addTwoIntegers(int x, int y);
>> > 	public String concatenateTwoStrings(String a, String b);	
>> > 	public String getVersion();
>> > }
>> > and, implemented it:
>> > ServiceTest.java
>> > package com.novaleaf.kauri.serviceinterfaces;
>> > import javax.jws.WebService;
>> > @WebService
>> > public class ServiceTest implements IServiceTest 
>> > {
>> >   	
>> >   public int addTwoIntegers(int x, int y){
>> > 	  return x+y;
>> >   }
>> >   public String concatenateTwoStrings(String a, String b){
>> > 	  return a+b;
>> >   }  
>> >   public String getVersion(){
>> > 	  return "1434933993";
>> >   }
>> > }
>> > It works fine (tested with various clients).  Very cool, and quite
>> easy!
>> > Then... I tried to test the services with Spring + Hibernate expecting
>> the same success
>> > Added 
>> > addUser(String firstName, String lastName, String password, String
>> email) 
>> > to the interface 
>> > and 
>> > private IUserDao userDao;
>> > 	
>> > public void setUserDao(UserDao userDao)
>> > {
>> >   this.userDao = userDao;
>> > }
>> > public void addUser(String firstName, String lastName, String password,
>> String email)
>> > {
>> >     User userToAdd = new User();
>> >     userToAdd.setFirstName(firstName);
>> >     userToAdd.setLastName(lastName);
>> >     userToAdd.setPassword(password);
>> >     userToAdd.setEmail(email);
>> >     userDao.AddUser(userToAdd);
>> > }
>> > To the service implementation
>> > 	
>> > As a note:
>> > The above example is injecting the dao.  However, I tried without the
>> setUserDao/spring bean and called and created a dao from within the
>> addUser function with the same result:
>> > the app doesn't deploy, tomcat doesn't start.
>> >  Log messages are below.  This might be a configuration or jar issue,
>> but I thought i'd drop this bug in here anyways.  
>> > Most of the services (about 80%) we will be using are little more than
>> wrappers for persistence calls - so it's kind of important to us to
>> figure out how to solve this.
>> > Messages
>> > log4j:WARN No appenders could be found for logger
>> (org.apache.commons.digester.Digester.sax).
>> > log4j:WARN Please initialize the log4j system properly.
>> > INFO
>> [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/kauri]]
>> - Initializing Spring root WebApplicationContext
>> > WARN [org.hibernate.cfg.Environment] - Property
>> [hibernate.cglib.use_reflection_optimizer] has been renamed to
>> [hibernate.bytecode.use_reflection_optimizer]; update your properties
>> appropriately
>> > ERROR [org.springframework.web.context.ContextLoader] - Context
>> initialization failed
>> > org.springframework.beans.factory.BeanCreationException: Error creating
>> bean with name 'serviceTest': Invocation of init method failed; nested
>> exception is org.apache.cxf.service.factory.ServiceConstructionException
>> > Caused by: 
>> > org.apache.cxf.service.factory.ServiceConstructionException
>> > 	at
>> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:269)
>> > 	at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.buildServiceFromClass(ReflectionServiceFactoryBean.java:220)
>> > 	at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initializeServiceModel(ReflectionServiceFactoryBean.java:248)
>> > 	at
>> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(ReflectionServiceFactoryBean.java:136)
>> > 	at
>> org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(AbstractEndpointFactory.java:83)
>> > 	at
>> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:89)
>> > 	at
>> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFactoryBean.java:142)
>> > 	at org.apache.cxf.jaxws.EndpointImpl.getServer(EndpointImpl.java:277)
>> > 	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:223)
>> > 	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:175)
>> > 	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:329)
>> > 	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.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1240)
>> > 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1205)
>> > 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1171)
>> > 	at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
>> > 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
>> > 	at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
>> > 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
>> > 	at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
>> > 	at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
>> > 	at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
>> > 	at
>> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
>> > 	at
>> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
>> > 	at
>> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
>> > 	at
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
>> > 	at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
>> > 	at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
>> > 	at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
>> > 	at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
>> > 	at
>> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
>> > 	at
>> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714)
>> > 	at
>> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490)
>> > 	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
>> > 	at
>> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
>> > 	at
>> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
>> > 	at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
>> > 	at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
>> > 	at
>> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
>> > 	at
>> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
>> > 	at
>> org.apache.catalina.core.StandardService.start(StandardService.java:448)
>> > 	at
>> org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
>> > 	at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
>> > 	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.catalina.startup.Bootstrap.start(Bootstrap.java:295)
>> > 	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
>> > Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 3
>> counts of IllegalAnnotationExceptions
>> > org.hibernate.Interceptor is an interface, and JAXB can't handle
>> interfaces.
>> > 	this problem is related to the following location:
>> > 		at org.hibernate.Interceptor
>> > 		at public org.hibernate.Interceptor
>> org.springframework.orm.hibernate3.HibernateAccessor.getEntityInterceptor()
>> throws
>> java.lang.IllegalStateException,org.springframework.beans.BeansException
>> > 		at org.springframework.orm.hibernate3.HibernateAccessor
>> > 		at org.springframework.orm.hibernate3.HibernateTemplate
>> > 		at public final org.springframework.orm.hibernate3.HibernateTemplate
>> org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()
>> > 		at org.springframework.orm.hibernate3.support.HibernateDaoSupport
>> > 		at com.novaleaf.kauri.dao.UserDao
>> > org.springframework.jdbc.support.SQLExceptionTranslator is an
>> interface, and JAXB can't handle interfaces.
>> > 	this problem is related to the following location:
>> > 		at org.springframework.jdbc.support.SQLExceptionTranslator
>> > 		at public org.springframework.jdbc.support.SQLExceptionTranslator
>> org.springframework.orm.hibernate3.HibernateAccessor.getJdbcExceptionTranslator()
>> > 		at org.springframework.orm.hibernate3.HibernateAccessor
>> > 		at org.springframework.orm.hibernate3.HibernateTemplate
>> > 		at public final org.springframework.orm.hibernate3.HibernateTemplate
>> org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()
>> > 		at org.springframework.orm.hibernate3.support.HibernateDaoSupport
>> > 		at com.novaleaf.kauri.dao.UserDao
>> > org.hibernate.SessionFactory is an interface, and JAXB can't handle
>> interfaces.
>> > 	this problem is related to the following location:
>> > 		at org.hibernate.SessionFactory
>> > 		at public org.hibernate.SessionFactory
>> org.springframework.orm.hibernate3.HibernateAccessor.getSessionFactory()
>> > 		at org.springframework.orm.hibernate3.HibernateAccessor
>> > 		at org.springframework.orm.hibernate3.HibernateTemplate
>> > 		at public final org.springframework.orm.hibernate3.HibernateTemplate
>> org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()
>> > 		at org.springframework.orm.hibernate3.support.HibernateDaoSupport
>> > 		at com.novaleaf.kauri.dao.UserDao
>> > 	at
>> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:66)
>> > 	at
>> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:389)
>> > 	at
>> com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.java:236)
>> > 	at
>> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:76)
>> > 	at
>> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.java:55)
>> > 	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 javax.xml.bind.ContextFinder.newInstance(Unknown Source)
>> > 	at javax.xml.bind.ContextFinder.find(Unknown Source)
>> > 	at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
>> > 	at
>> org.apache.cxf.jaxb.JAXBDataBinding.createJAXBContext(JAXBDataBinding.java:397)
>> > 	at
>> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java:267)
>> > 	... 51 more
>> 
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Re%3A--jira--Commented%3A-%28CXF-794%29-Hibernate-%2B-Spring-%3D-Crashing-%28for%09me%29-tf4100198.html#a12012797
Sent from the cxf-dev mailing list archive at Nabble.com.


Mime
View raw message