Results 1 to 2 of 2

Thread: JNDI lookup on stateful remote bean

  1. #1
    Join Date
    Sep 2007
    Posts
    1

    Default 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 [org.eclipse.hyades.logging.events.cbe.impl.EventFactoryImpl@be208f7] 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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 .
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •