Dan, Just a quick clarification regarding the control of the interfaces-to-implementation mapping (i.e. http://xfire.codehaus.org/Aegis+Binding), we're using Spring to configure our Xfire services, can this property be set in our Spring app-config file (i.e. the ServiceBean) or in some other similar way?
I can see how one can do it programmatically as captured in the docs but we'd like to use Dependency-Injection if at all possible. -jd ________________________________ HP logo John Daly Engineer Specialist Imaging and Printing Group IT Phone: 208-396-4465 Fax: 208-396-3010 [EMAIL PROTECTED] ________________________________ >-----Original Message----- >From: Dan Diephouse [mailto:[EMAIL PROTECTED] >Sent: Monday, May 01, 2006 11:24 AM >To: [email protected] >Subject: Re: [xfire-user] Re: Xfire Client Proxy -> Hibernate mapping >problem > >Yes, see the section at the bottom of the link I sent you. That will >give you instructions on how to tell XFire what implementation class to >use. >- Dan > >Daly, John (Boise IPG-IT) wrote: >> Dan, >> >> Yes, we do our best to design/develop to interfaces as a general >practice. If you take a look at the IEchoWebService below you'll see that >all the "I" types (i.e. IEcho, IQuery, etc) are all interfaces. >> >> And yes, you are correct, Hibernate is not recognizing the proxy that is >created in place of my IEcho interface resulting in a Hibernate Mapping >exception (i.e. HibernateSystemException: Unknown entity: $Proxy14; nested >exception is org.hibernate.MappingException: Unknown entity: $Proxy14), so >the problem at hand is how to tease the proxy into the real interface it >would seem. >> >> -jd >> >> public interface IEchoWebService >> { >> /** >> * Creates a blank object by calling Echo's constructor >> * >> * @return the new IEcho object >> */ >> public IEcho createEcho(); >> >> /** >> * Creates a query object based on the inputted object and returns >that >> * object >> * >> * @param echoQuery >> * is the object that the query is based on >> * @exception QueryException >> * if the inputted object to base the query on was >null >> * @return the query object to be used for searches >> */ >> public IQuery createQuery(IEcho echoQuery); >> >> /** >> * Given a query object, the function searches the database for all >matching >> * echos. Returns a single item if only one item matched or null if >nothing >> * was found in the search. >> * >> * @param query >> * object to be used to search the database >> * @exception FindException >> * only if the inputted query was null >> * @return the object found or null if nothing was found >> */ >> public IEcho findEcho(IQuery query); >> >> ..... >> ..... >> >> >>> -----Original Message----- >>> From: Dan Diephouse [mailto:[EMAIL PROTECTED] >>> Sent: Monday, May 01, 2006 10:46 AM >>> To: [email protected] >>> Cc: Mika Göckel >>> Subject: Re: [xfire-user] Re: Xfire Client Proxy -> Hibernate mapping >>> problem >>> >>> I'm wondering - does your service class use interfaces in the method >>> parameters? Aegis will create proxy for interfaces. Hibernate probably >>> isn't recognizing this class. In XFire 1.1-RC+ you can specify which >>> implementation class you want to use. See the bottom of this page: >>> >>> http://xfire.codehaus.org/Aegis+Binding >>> >>> - Dan >>> >>> John Daly wrote: >>> >>>> Mika/Dan, >>>> >>>> I was hoping that I could get some feedback on the issue I'm having >>>> below regarding prioxies and hibernate mapping. Any pointers or >>>> thoughts would be appreciated. >>>> Thx. >>>> >>>> John Daly wrote: >>>> >>>> >>>>> Mika/Dan, et al, >>>>> >>>>> In my JUint test testInsertEcho() below I'm calling a factory method >>>>> on my service 'createEcho()' which creates an IEcho object, >>>>> initializes it, and establishes it with Hibernate prior to returning >>>>> the object for use later by the caller. As you know, with Xfire in >>>>> the middle a proxy object for IEcho is created for this object and >>>>> returned to the caller in place of the real IEcho instance. I ran >>>>> into a bit of a snag when executing the next step in the test (i.e. >>>>> this._remoteService.insertEcho(echo1);) which attempts to persist the >>>>> incoming object to the database backing my IEchoWebService. >>>>> In this case, Hibernate generates the exception (i.e. >>>>> HibernateSystemException: Unknown entity: $Proxy14; nested exception >>>>> is org.hibernate.MappingException: Unknown entity: $Proxy14) (See Log >>>>> below) which makes perfect sense given that the proxy has been >>>>> substituted for the real IEcho object and Hibernate knows nothing >>>>> about any Proxy objects. >>>>> >>>>> My question is, how should this sort of thing be handled? Is there a >>>>> way to resolve the proxy back to its proxies equivalent? Is there a >>>>> better/different approach? On the server-side of the equation I >>>>> presently have an intermediate interface >>>>> (IEchoWebService)/implementation(EchoWebservice) which simply >>>>> forwards the calls on to the real IEcho Service that does all the >>>>> work. This approach allows me to control which api's of my real >>>>> services that I want to expose. I was thinking there maybe some way >>>>> to deal with the proxy issues at in my EchoWebService implementation >>>>> that would translated the proxy back to the real IEcho object before >>>>> forwarding the calls on to the IEchoService itself, but don't know if >>>>> there is a way to do that sort of thing or if it is the best approach. >>>>> >>>>> Any and all thoughts/suggestions are welcome >>>>> >>>>> Thanks again, >>>>> -jd >>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~ JUNIT ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>>> public class EchoWebServiceTest extends AbstractXFireSpringTest >>>>> { >>>>> private final Log _log = LogFactory.getLog(getClass()); >>>>> private IEchoWebService _localService = null; >>>>> private IEchoWebService _remoteService = null; >>>>> public void setUp() throws Exception >>>>> { >>>>> super.setUp(); >>>>> Service serviceModel = new >>>>> ObjectServiceFactory().create(IEchoWebService.class); >>>>> XFire xfire = XFireFactory.newInstance().getXFire(); >>>>> XFireProxyFactory factory = new XFireProxyFactory(xfire); >>>>> >>>>> _localService = (IEchoWebService) factory.create(serviceModel, >>>>> "xfire.local://IEchoWebService"); >>>>> _remoteService = (IEchoWebService) new >>>>> XFireProxyFactory().create(serviceModel, >>>>> "http://localhost:8080/ssa-echo- >>>>> >>> service/EchoServiceSoap11.xfireservice"); >>> >>>>> } >>>>> >>>>> public void testInsertEcho() >>>>> { >>>>> // Create an IEcho object initializing it accordingly. >>>>> IEcho echo1 = this._remoteService.createEcho(); >>>>> assertNotNull(echo1); >>>>> >>>>> // Update the message for grins and giggles >>>>> echo1.setMessage("This is a test"); >>>>> >>>>> // Attempt to persist the echo >>>>> IEcho echo2 = this._remoteService.insertEcho(echo1); >>>>> >>>>> // Verify we got the persisted object back. >>>>> assertNotNull(echo2); >>>>> assertEquals(echo1.getMessage(), echo2.getMessage()); >>>>> } >>>>> >>>>> protected ApplicationContext createContext() >>>>> { >>>>> String ssaPkg = >>>>> ClassUtils.classPackageAsResourcePath(GlobalConstants.class); >>>>> String[] paths = { "classpath*:/" + ssaPkg + >>>>> "/**/*applicationContext*.xml" }; >>>>> return new ClassPathXmlApplicationContext(paths); >>>>> } >>>>> >>>>> } >>>>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tomcat >>>>> Logs~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >>>>> 2006-04-21 10:21:16,982 DEBUG >>>>> [org.codehaus.xfire.transport.DefaultEndpoint] - Received message to >>>>> /ssa-echo-service/EchoServiceSoap11.xfireservice >>>>> 2006-04-21 10:21:16,983 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.soap.handler.ReadHeadersHandler in phase parse >>>>> 2006-04-21 10:21:16,983 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.handler.LocateBindingHandler in phase dispatch >>>>> 2006-04-21 10:21:16,983 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.soap.handler.SoapBodyHandler in phase dispatch >>>>> 2006-04-21 10:21:16,984 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.soap.handler.SoapActionInHandler in phase dispatch >>>>> 2006-04-21 10:21:16,984 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.handler.DispatchServiceHandler in phase dispatch >>>>> 2006-04-21 10:21:16,984 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.soap.handler.ValidateHeadersHandler in phase >>>>> pre-invoke >>>>> 2006-04-21 10:21:16,984 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.service.binding.ServiceInvocationHandler in phase >>>>> service >>>>> 2006-04-21 10:21:17,036 DEBUG >>>>> [org.codehaus.xfire.handler.DefaultFaultHandler] - Fault occurred! >>>>> org.codehaus.xfire.fault.XFireFault: Unknown entity: $Proxy14; nested >>>>> exception is org.hibernate.MappingException: Unknown entity: $Proxy14 >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.j >>> ava:68) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(Ser >>> viceInvocationHandler.java:260) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(ServiceIn >>> vocationHandler.java:85) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(Service >>> InvocationHandler.java:132) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(ServiceI >>> nvocationHandler.java:107) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:98) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java >>> :60) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:3 >>> 8) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.transport.http.XFireServletController.invoke(XFireServle >>> tController.java:287) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.transport.http.XFireServletController.doService(XFireSer >>> vletController.java:146) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.spring.remoting.XFireServletControllerAdapter.handleRequ >>> est(XFireServletControllerAdapter.java:63) >>> >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.spring.remoting.XFireExporter.handleRequest(XFireExporte >>> r.java:44) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(S >>> impleControllerHandlerAdapter.java:44) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServ >>> let.java:717) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServl >>> et.java:658) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkSe >>> rvlet.java:392) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.ja >>> va:357) >>> >>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:709) >>>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio >>> nFilterChain.java:237) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC >>> hain.java:157) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j >>> ava:214) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte >>> xt.java:104) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContex >>> tValve.java:198) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j >>> ava:152) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte >>> xt.java:104) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:13 >>> 7) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte >>> xt.java:104) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:11 >>> 8) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte >>> xt.java:102) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav >>> a:109) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveConte >>> xt.java:104) >>> >>>>> at >>>>> >>>>> >>> >org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520) >>> >>>>> at >>>>> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929) >>>>> at >>>>> >org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160) >>>>> at >>>>> >>>>> >>> >org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799) >>> >>>>> at >>>>> >>>>> >>> >org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConn >>> ection(Http11Protocol.java:705) >>> >>>>> at >>>>> >>>>> >>> >org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577) >>> >>>>> at >>>>> >>>>> >>> >org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.ja >>> va:683) >>> >>>>> at java.lang.Thread.run(Thread.java:534) >>>>> Caused by: >>>>> org.springframework.orm.hibernate3.HibernateSystemException: Unknown >>>>> entity: $Proxy14; nested exception is org.hibernate.MappingException: >>>>> Unknown entity: $Proxy14 >>>>> at >>>>> >>>>> >>> >org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAcce >>> ssException(SessionFactoryUtils.java:661) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccess >>> Exception(HibernateAccessor.java:413) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTempl >>> ate.java:370) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.orm.hibernate3.HibernateTemplate.saveOrUpdate(Hibernate >>> Template.java:687) >>> >>>>> at >>>>> >>>>> >>> >com.hp.ipgit.ssa.echoservice.persistence.hibernate.EchoServiceDAOHibernate. >>> insert(Unknown >>> >>>>> Source) >>>>> at >>>>> com.hp.ipgit.ssa.echoservice.business.EchoService.insertEcho(Unknown >>>>> Source) >>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> at >>>>> >>>>> >>> >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 >>> 9) >>> >>>>> at >>>>> >>>>> >>> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp >>> l.java:25) >>> >>>>> at java.lang.reflect.Method.invoke(Method.java:324) >>>>> at >>>>> >>>>> >>> >org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Aop >>> Utils.java:335) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoin >>> t(ReflectiveMethodInvocation.java:181) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec >>> tiveMethodInvocation.java:148) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.transaction.interceptor.TransactionInterceptor.invoke(T >>> ransactionInterceptor.java:96) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(Reflec >>> tiveMethodInvocation.java:170) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr >>> oxy.java:176) >>> >>>>> at $Proxy12.insertEcho(Unknown Source) >>>>> at >>>>> >>>>> >>> >com.hp.ipgit.ssa.echoservice.remoting.xfire.EchoWebService.insertEcho(Unkno >>> wn >>> >>>>> Source) >>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> at >>>>> >>>>> >>> >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 >>> 9) >>> >>>>> at >>>>> >>>>> >>> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp >>> l.java:25) >>> >>>>> at java.lang.reflect.Method.invoke(Method.java:324) >>>>> at >>>>> >>>>> >>> >org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(Aop >>> Utils.java:335) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopPr >>> oxy.java:165) >>> >>>>> at $Proxy13.insertEcho(Unknown Source) >>>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) >>>>> at >>>>> >>>>> >>> >sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:3 >>> 9) >>> >>>>> at >>>>> >>>>> >>> >sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImp >>> l.java:25) >>> >>>>> at java.lang.reflect.Method.invoke(Method.java:324) >>>>> at >>>>> >>>>> >>> >org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(AbstractInvoker.j >>> ava:52) >>> >>>>> ... 42 more >>>>> Caused by: org.hibernate.MappingException: Unknown entity: $Proxy14 >>>>> at >>>>> >>>>> >>> >org.hibernate.impl.SessionFactoryImpl.getEntityPersister(SessionFactoryImpl >>> .java:569) >>> >>>>> at >>>>> >org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1086) >>>>> at >>>>> org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180) >>>>> at >>>>> >>>>> >>> >org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSa >>> veEventListener.java:409) >>> >>>>> at >>>>> >>>>> >>> >org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdat >>> e(DefaultSaveOrUpdateEventListener.java:82) >>> >>>>> at >>>>> >>>>> >>> >org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(Def >>> aultSaveOrUpdateEventListener.java:69) >>> >>>>> at >>>>> org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:468) >>>>> at >>>>> org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:463) >>>>> at >>>>> >>>>> >>> >org.springframework.orm.hibernate3.HibernateTemplate$18.doInHibernate(Hiber >>> nateTemplate.java:690) >>> >>>>> at >>>>> >>>>> >>> >org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTempl >>> ate.java:365) >>> >>>>> ... 69 more >>>>> 2006-04-21 10:21:17,042 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.soap.handler.FaultSoapSerializerHandler in phase >>>>> post-invoke >>>>> 2006-04-21 10:21:17,042 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.handler.CustomFaultHandler in phase user >>>>> 2006-04-21 10:21:17,042 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> >>>>> >>> >org.codehaus.xfire.transport.http.XFireServletController$FaultResponseCodeH >>> andler >>> >>>>> in phase transport >>>>> 2006-04-21 10:21:17,042 DEBUG >>>>> [org.codehaus.xfire.handler.HandlerPipeline] - Invoking handler >>>>> org.codehaus.xfire.fault.FaultSender in phase send >>>>> >>>>> >>>>> >>> -- >>> Dan Diephouse >>> Envoi Solutions >>> http://envoisolutions.com >>> http://netzooid.com/blog >>> >> >> > > >-- >Dan Diephouse >Envoi Solutions >http://envoisolutions.com >http://netzooid.com/blog
