Announcement Announcement Module
Collapse
No announcement yet.
Invoking Stateful Session Bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Invoking Stateful Session Bean

    How to invoke remote stateful session bean methods multiple times inside one client method?

    I have a Stateful session Bean with 3 methods. m1(), m2() and m3().
    In this method m3 is @Remove method.

    Client code:
    Code:
    for loop {
      sfsb = Context.getBean() //Stateful Session Bean Lookup (Spring)
      sfsb.m1();
      sfsb.m2();
      sfsb.m3();
    }
    Spring config for bean lookup:
    Code:
    <bean id="paymentManager"
    		class="org.springframework.jndi.JndiObjectFactoryBean">
    		<property name="jndiName" value="ejb/PaymentManager" />
    		<property name="resourceRef" value="true"/>
    		<property name="jndiEnvironment">
    			<props>
    				<prop key="java.naming.factory.initial">
    					com.ibm.websphere.naming.WsnInitialContextFactory
    				</prop>
    				<prop key="java.naming.provider.url">corbaloc:iiop:localhost:2810</prop>
    			</props>
    		</property>
    	</bean>
    For the first iteration everything will work. But second iteration will fail with message "Bean was removed or timed out."
Working...
X