2 Replies Latest reply on Dec 5, 2012 6:09 AM by Wolf-Dieter Fink

    SFSB removal in jboss 5.1

    Bond Chan Novice

      We're upgrading the jboss from jboss 4.2.3 to jboss 5.1.0, which is not a easy journey indeed, I will share the experience when all this get finished, we almost finished with one issue left. We used to call the remove() method of  Remote interface, to remove the SFSB when we finished use, however this works in jboss 4.2.3, not in jboss 5.1.0

       

      #because one of our SFSB container was configured with  <cache-policy>org.jboss.ejb.plugins.NoPassivationCachePolicy</cache-policy>, according to jboss doc, we need to remove the bean instance explicitly

       

      is there any way I can do it in jboss 5.1.0 ?

       

       

      error stack:

       

      javax.ejb.RemoveException: An attempt to remove a session object while the object is in a transaction (EJB2.1, 7.6.4 Restrictions for Transactions): ejb-name=FxLoader, method=public abstract void javax.ejb.EJBObject.remove() throws java.rmi.RemoteException,javax.ejb.RemoveException, tx=TransactionImple < ac, BasicAction: -53ebe106:11f7:50bd850b:186a status: ActionStatus.RUNNING >

                at org.jboss.ejb.StatefulSessionContainer$ContainerInterceptor.invoke(StatefulSessionContainer.java:580)

                at com.lombardrisk.f3.logging.StatefulLifecycleLoggingInterceptor.invoke(StatefulLifecycleLoggingInterceptor.java:66)

                at com.lombardrisk.f3.accesscontrol.JBossEJBInterceptor.invoke(JBossEJBInterceptor.java:139)

                at org.jboss.ejb.plugins.SecurityInterceptor.process(SecurityInterceptor.java:228)

                at org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.java:211)

                at org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke(CachedConnectionInterceptor.java:156)

                at org.jboss.ejb.plugins.StatefulSessionInstanceInterceptor.invoke(StatefulSessionInstanceInterceptor.java:348)

                at com.lombardrisk.f3.audit.AuditTrailInterceptor.invoke(AuditTrailInterceptor.java:233)

                at org.jboss.ejb.plugins.CallValidationInterceptor.invoke(CallValidationInterceptor.java:63)

                at org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterceptor.java:121)

                at org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxInterceptorCMT.java:350)

                at org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:181)

                at org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:205)

                at com.lombardrisk.f3.logging.ElapsedTimeInterceptor.invoke(ElapsedTimeInterceptor.java:41)

                at com.lombardrisk.f3.logging.ElapsedTimeInterceptor.invoke(ElapsedTimeInterceptor.java:41)

                at org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invoke(ProxyFactoryFinderInterceptor.java:138)

                at org.jboss.ejb.SessionContainer.internalInvoke(SessionContainer.java:650)

                at org.jboss.ejb.Container.invoke(Container.java:1029)

                at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                at java.lang.reflect.Method.invoke(Method.java:597)

                at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)

                at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)

                at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)

                at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)

                at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)

                at org.jboss.system.server.jmx.LazyMBeanServer.invoke(LazyMBeanServer.java:283)

                at org.jboss.invocation.local.LocalInvoker$MBeanServerAction.invoke(LocalInvoker.java:169)

                at org.jboss.invocation.local.LocalInvoker.invoke(LocalInvoker.java:118)

                at org.jboss.invocation.InvokerInterceptor.invokeLocal(InvokerInterceptor.java:209)

                at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:195)

                at org.jboss.proxy.TransactionInterceptor.invoke(TransactionInterceptor.java:61)

                at org.jboss.proxy.ejb.SecurityContextInterceptor.invoke(SecurityContextInterceptor.java:64)

                at org.jboss.proxy.SecurityInterceptor.invoke(SecurityInterceptor.java:68)

                at org.jboss.proxy.ejb.StatefulSessionInterceptor.invoke(StatefulSessionInterceptor.java:118)

                at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:101)

                at $Proxy1996.remove(Unknown Source)

                at com.lombardrisk.marketdata.FXRatesServiceBean.buildFxCache(FXRatesServiceBean.java:378)

        • 1. Re: SFSB removal in jboss 5.1
          Bond Chan Novice

          code:

           

          FinancialInstrumentLoaderRemote loader =  this.financialInstrumentServiceRemote.getLoader(fid.getType());  //get the SFSB remote interface

           

                                                  FinancialInstrument financialInstrument =

                                                            this.financialInstrumentServiceRemote.getFinancialInstrumentAtTime(

                                                               loader,   //use it

                                                                      fKey,

                                                                      date,

                                                                      realTimeStamp);

                                                  FX fx = (FX) financialInstrument;

           

                                                  try {

                                                            log.error("call loader.remove()");

                                                            loader.remove(); // remove it

                                                  } catch (RemoveException e) {

                                                            // TODO Auto-generated catch block

                                                            log.error("error of remove loader" + e);

                                                  }

          • 2. Re: SFSB removal in jboss 5.1
            Wolf-Dieter Fink Master

            As described in the ejb spec (see error) the remove-method can not be called in a transaction. You have to rollback or commit the transaction first.