Announcement Announcement Module
Collapse
No announcement yet.
JNDI lookup on stateful remote bean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • JNDI lookup on stateful remote bean

    Hi.

    Currently, I have the following code snippet in one of the classes:
    Code:
    InitialContext initialCtx = new InitialContext();
    
    EventFactory eventFactory = (EventFactory) javax.rmi.PortableRemoteObject.narrow(initialCtx
    					.lookup("com/ibm/websphere/events/factory"), EventFactory.class);
    I'd like to have Spring handle the lookup itself.
    So, I created the following Spring bean configuration:
    Code:
    	<bean id="eventFactory" class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
    		<property name="jndiName">
    			<value>com/ibm/websphere/events/factory</value>
    		</property>
    		<property name="businessInterface">
    			<value>org.eclipse.hyades.logging.events.cbe.EventFactory</value>
    		</property>
    	</bean>
    and use IoC to inject into the code (using setters).

    The thing is, that I get an exception:
    Code:
    EJB home [[email protected]f7] has no no-arg create() method
    Which led me to think it's a stateful bean.

    any idea why this code does not work, or how to access a remote stateful bean via spring proxy?

    Thanks

  • #2
    Well not by the SimpleRemoteStatelessSessionProxyFactoryBean. Stateless and Statefull beans have different requirements, one of those requirements it that a Stateless bean always has a no-arg constructor, which is what this FactoryBean uses.

    There have been some threads about Stateful Session Beans and Spring however, you might find this one interesting. If not use the search .

    Comment

    Working...
    X