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:

--- server log ---
[#|2007-12-28T17:48:10.129+0100|WARNING|sun-appserver9.1|javax.enterpris
e.resource.corba.ee._CORBA_.util|_ThreadID=17;_ThreadName=httpSSLWorkerT
hread-8080-1;org.apache.myfaces.orchestra.conversation.CurrentConversati
onAdvice;_RequestID=50deac38-4c13-4e42-b0a7-29460f21969c;|"IOP00100006:
(BAD_PARAM) Class
org.apache.myfaces.orchestra.conversation.CurrentConversationAdvice is
not Serializable"
--- server log ---

Here is the code I am using to propagate the scoped beans to the JBPM
variable map:

--- code ---
[...]
import org.apache.myfaces.orchestra.conversation.Conversation;
import org.apache.myfaces.orchestra.conversation.ConversationManager;
import
org.apache.myfaces.orchestra.conversation.CurrentConversationAdvice;
import org.apache.myfaces.orchestra.frameworkAdapter.FrameworkAdapter;
import org.springframework.aop.scope.ScopedObject;

import com.sun.faces.application.NavigationHandlerImpl;

public class JbpmNavigationHandler extends NavigationHandler {

[...]

                        // transfer conversation scoped variables to
pageflow variable map
                        Iterator<Conversation> i =
ConversationManager.getInstance()
        
.getCurrentConversationContext().iterateConversations();
                        while (i.hasNext()) {
                                Conversation conversation = i.next();
                                String beanName =
conversation.getName();

                                if
(pageflow.getContextInstance().getVariable(beanName) == null) {
                                        // get the bean (proxy)
                                        ScopedObject orchestraProxy =
(ScopedObject) FrameworkAdapter
        
.getCurrentInstance().getBean(beanName);

                                        // dereference spring proxy
                                        Object bean =
orchestraProxy.getTargetObject();

                                        logger.debug("resolved proxy ["
+ orchestraProxy
                                                        + "] to target
[" + bean + "]");

                                        // ! not the "real bean" but
CurrentConversationAdvice as another proxy (?)
        
pageflow.getContextInstance().setTransientVariable(
                                                        beanName, bean);
                                }
                        }
--- code ---

Anyone having a hint for me?

Thanks + regards

malte.

Reply via email to