Hi Malte, I know this is rather a late response, but I've finally looked into drilling down from a proxy to a real bean, and it isn't very difficult.
See method _SpringUtils.getRealBean (currently in svn only). It's not a public method because I don't know if we can provide it for systems other than Spring. But the code can be called directly (just no promises about later releases) or can just be copied. http://svn.apache.org/repos/asf/myfaces/orchestra/trunk/core/src/main/java/org/apache/myfaces/orchestra/conversation/spring/ Regards, Simon On Wed, 2008-02-06 at 17:02 +0100, Schnack, Malte wrote: > Hi, > > to finish this one up, here is a code snipped that does not really resolve > the "real bean", but delivers the expected behaviour: > > --- > > // 0: get the bean (proxy) > Object proxy = FrameworkAdapter.getCurrentInstance().getBean( > beanName); > > // 1: un-proxy the Spring Scoped Object > while (proxy instanceof ScopedObject) { > proxy = ((ScopedObject) proxy).getTargetObject(); > } > > // 2: populate a bean instance of the superclass which the CGLIB proxy > inherits from > Class requiredClass = proxy.getClass().getSuperclass(); > > Object bean = BeanUtils.instantiateClass(requiredClass); > BeanUtils.copyProperties(proxy, bean); > > --- > > The Variable "bean" now holds an instance of the original class which can > then be marshalled for RMI calls. > > My misconception was that I thought, I could get hold of a reference to an > instance of my original bean class when obtaining the Spring ScopedObject's > target. Instead, what you really get is another CGLIB proxy. I assume that > Spring is not aware of this _second_ proxy as this one is crafted by > Orchestra. Hence the condition (proxy instanceof ScopedObject) is false. > > Kind regards > > malte. > > > > -----Ursprüngliche Nachricht----- > > Von: simon [mailto:[EMAIL PROTECTED] > > Gesendet: Freitag, 28. Dezember 2007 19:18 > > An: MyFaces Discussion > > Betreff: Re: Orchestra: how to access the "real bean" behind > > the proxies? > > > > > > On Fri, 2007-12-28 at 18:11 +0100, Schnack, Malte wrote: > > > In Orchestra, I want to access the "real bean" behind the proxies to > > > make it available in another context (eg a JBPM variable map). This > > > seems to be necessary for serialization when invoking an RMI method > > > using the Orhestra/Spring conversation scoped bean as parameter DTO > > > object. This is what is happening inside my JBPM process definition. > > > > > > I already used the ScopedObject method getTargetObject() included in > > > Spring. This did not resolve to the "real bean" though but to the > > > CurrentConversationAdvice. When trying to perform the RMI call, my > > > Glassfish v2 server log shows the following error message: > > > > I think the CurrentConversationAdvice can also be cast to > > ScopedObject. > > Have you tried this? > > Object bean = ...; > > while (bean instanceof ScopedObject) > > bean = ((ScopedObject) bean).getTargetObject(); > > > > Regards, > > > > Simon > > > >

