1 Reply Latest reply on Sep 23, 2002 10:58 PM by Donald

    Problem serializing stateful session bean remote interface h

    George Francis Newbie

      I am having a problem serialising a javax.ejb.Handle to a stateful session bean, and I suspect JBoss may be responsible.
      The code Im using to serailise the EJB handle is:

      Handle handle = mybean.getHandle();
      FileOutputStream fos = new FileOutputStream("myhandle.ser");
      ObjectOutputStream outStream = new ObjectOutputStream(fos);

      This works fine when mybean is an instance of the remote interface of a stateless session bean. However, when mybean is an instance of a statefull session bean, I get the following stack trace from JBoss:

      java.rmi.ServerException: Invalid remote object; nested exception is:
      java.rmi.MarshalException: Invalid remote object
      at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:140)
      at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:176)
      at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:61)
      at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:183)
      at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderIntercep
      at org.jboss.ejb.StatefulSessionContainer.invoke(StatefulSessionContainer.java:370)
      at org.jboss.ejb.Container.invoke(Container.java:687)
      at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:549)
      at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:100)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:88)
      at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:51)
      at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:48)
      at org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:82)
      at $Proxy62.logon(Unknown Source)

      This exception is thrown when execution reaches the line:

      Has anyone been able to serialize a statefull session bean in JBoss? If so, what code are you using?

        • 1. Re: Problem serializing stateful session bean remote interfa
          Donald Newbie

          I have a similar issue. I get the Invalid remote object when I have a stateful session bean holding an object that has a stateful session bean reference in it. What triggers this is the Passivation of the outer EJB. as the server passivates the bean it chokes on the reference to the other stateful session bean.

          I know that perhaps it is a naming issue or RMI/IIOP issue. Invalid remote object implies that the mapping or communication mechanism between stub and proxy is not correct. But with the way that Jboss is designed it does not need any stubs that are normally created for the references.