cxf-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: [jira] Commented: (CXF-794) Hibernate + Spring = Crashing (for me)
Date Mon, 06 Aug 2007 14:22:35 GMT
Diego,

On Monday 06 August 2007 04:45, Diego Xu wrote:
> 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.

Couple of thoughts:
1) This may be related to:
https://issues.apache.org/jira/browse/CXF-813
where methods are mapped into the wsdl from the Impl instead of just the 
interface.    This is fixed in 2.0.1 which is currently being voted on, 
you can get the candidate from:
http://people.apache.org/~dkulp/stage_cxf/2.0.1-incubator_take2/dist/

2)  Even with 2.0, you should be able to add @WebMethod(exclude = true)
to the methods that shouldn't be mapped.

Dan



> 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.ji
> >>ra.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].[/ka
> >>uri]] - 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.buildSe
> >>rviceFromClass(ReflectionServiceFactoryBean.java:220)
> >>
> >> > 	at
> >>
> >> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.initial
> >>izeServiceModel(ReflectionServiceFactoryBean.java:248)
> >>
> >> > 	at
> >>
> >> org.apache.cxf.service.factory.ReflectionServiceFactoryBean.create(
> >>ReflectionServiceFactoryBean.java:136)
> >>
> >> > 	at
> >>
> >> org.apache.cxf.frontend.AbstractEndpointFactory.createEndpoint(Abst
> >>ractEndpointFactory.java:83)
> >>
> >> > 	at
> >>
> >> org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.
> >>java:89)
> >>
> >> > 	at
> >>
> >> org.apache.cxf.jaxws.JaxWsServerFactoryBean.create(JaxWsServerFacto
> >>ryBean.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.AbstractAutowireCapableBe
> >>anFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.
> >>java:1240)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.AbstractAutowireCapableBe
> >>anFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:
> >>1205)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.AbstractAutowireCapableBe
> >>anFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:117
> >>1)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.AbstractAutowireCapableBe
> >>anFactory.createBean(AbstractAutowireCapableBeanFactory.java:425)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.AbstractBeanFactory$1.get
> >>Object(AbstractBeanFactory.java:251)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.DefaultSingletonBeanRegis
> >>try.getSingleton(DefaultSingletonBeanRegistry.java:156)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.AbstractBeanFactory.getBe
> >>an(AbstractBeanFactory.java:248)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.AbstractBeanFactory.getBe
> >>an(AbstractBeanFactory.java:160)
> >>
> >> > 	at
> >>
> >> org.springframework.beans.factory.support.DefaultListableBeanFactor
> >>y.preInstantiateSingletons(DefaultListableBeanFactory.java:287)
> >>
> >> > 	at
> >>
> >> org.springframework.context.support.AbstractApplicationContext.refr
> >>esh(AbstractApplicationContext.java:352)
> >>
> >> > 	at
> >>
> >> org.springframework.web.context.ContextLoader.createWebApplicationC
> >>ontext(ContextLoader.java:244)
> >>
> >> > 	at
> >>
> >> org.springframework.web.context.ContextLoader.initWebApplicationCon
> >>text(ContextLoader.java:187)
> >>
> >> > 	at
> >>
> >> org.springframework.web.context.ContextLoaderListener.contextInitia
> >>lized(ContextLoaderListener.java:49)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.StandardContext.listenerStart(StandardCont
> >>ext.java:3764)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.StandardContext.start(StandardContext.java
> >>:4216)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBa
> >>se.java:760)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:
> >>740)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:54
> >>4)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:82
> >>5)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:7
> >>14)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:4
> >>90)
> >>
> >> > 	at
> >> > org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138
> >> >) at
> >>
> >> org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.ja
> >>va:311)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecy
> >>cleSupport.java:120)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:102
> >>2)
> >>
> >> > 	at
> >> > org.apache.catalina.core.StandardHost.start(StandardHost.java:736
> >> >) at
> >>
> >> org.apache.catalina.core.ContainerBase.start(ContainerBase.java:101
> >>4)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.StandardEngine.start(StandardEngine.java:4
> >>43)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.StandardService.start(StandardService.java
> >>:448)
> >>
> >> > 	at
> >>
> >> org.apache.catalina.core.StandardServer.start(StandardServer.java:7
> >>00)
> >>
> >> > 	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.getEntityInter
> >>ceptor() throws
> >> java.lang.IllegalStateException,org.springframework.beans.BeansExce
> >>ption
> >>
> >> > 		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.getH
> >>ibernateTemplate()
> >>
> >> > 		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.getJdbcExcepti
> >>onTranslator()
> >>
> >> > 		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.getH
> >>ibernateTemplate()
> >>
> >> > 		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.getSessionFact
> >>ory()
> >>
> >> > 		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.getH
> >>ibernateTemplate()
> >>
> >> > 		at
> >> > org.springframework.orm.hibernate3.support.HibernateDaoSupport at
> >> > com.novaleaf.kauri.dao.UserDao
> >> > 	at
> >>
> >> com.sun.xml.bind.v2.runtime.IllegalAnnotationsException$Builder.che
> >>ck(IllegalAnnotationsException.java:66)
> >>
> >> > 	at
> >>
> >> com.sun.xml.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBCont
> >>extImpl.java:389)
> >>
> >> > 	at
> >>
> >> com.sun.xml.bind.v2.runtime.JAXBContextImpl.<init>(JAXBContextImpl.
> >>java:236)
> >>
> >> > 	at
> >>
> >> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.jav
> >>a:76)
> >>
> >> > 	at
> >>
> >> com.sun.xml.bind.v2.ContextFactory.createContext(ContextFactory.jav
> >>a: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(JAXBDataBindi
> >>ng.java:397)
> >>
> >> > 	at
> >>
> >> org.apache.cxf.jaxb.JAXBDataBinding.initialize(JAXBDataBinding.java
> >>:267)
> >>
> >> > 	... 51 more

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
View raw message