Announcement Announcement Module
Collapse
No announcement yet.
Calling EJB3 SLSB with Spring : what syntax ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Calling EJB3 SLSB with Spring : what syntax ?

    Hi.
    I find the Spring 2.5 manual (chapter 18) unclear regarding the syntax that EJB3 clients need to declare in order to be able to call a remote SLSB EJB3.
    Should we use a SimpleRemoteStatelessSessionProxyFactoryBean (like I was used to doing with EJB 2.1) ?
    I.e. something like :
    Code:
    <bean id="myComponent"
    class="org.springframework.ejb.access.SimpleRemoteStatelessSessionProxyFactoryBean">
      <property name="jndiName" value="ejb/myBean"/>
      <property name="businessInterface" value="com.mycom.MyComponent"/>
    </bean>
    (Is there anything missing in the syntax above ?)

    Or should we use the <jee:remote-slsb> tag ?
    I.e. something like :
    Code:
    <jee:remote-slsb id="myComponent" jndi-name="ejb/myBean"
          business-interface="com.mycom.MyComponent"/>
    Please, can someone let me know which of the two is correct (or both), and what may be missing in the syntax ?

  • #2
    Neither...

    Simply do a Jndi lookup, the approach above is only needed and valid for EJB before version 3.

    So a simple jndi-lookup is enough.

    Code:
    <jee:jndi-lookup jndi-name="ejb/mybean" business-interface="com.mycom.MyComponent" />

    Comment


    • #3
      Thanks for your answer.
      As a remark, here is what it says in paragraph 18.2.4 of the Spring 2.5 manual :
      Note: For EJB 3 Session Beans, you could effectively use a JndiObjectFactoryBean / <jee:jndi-lookup> as well, since fully usable component references are exposed for plain JNDI lookups there. Defining explicit <jee:local-slsb> / <jee:remote-slsb> lookups simply provides consistent and more explicit EJB access configuration.

      Comment


      • #4
        BTW, I just had a quick look at the schema definition (http://www.springframework.org/schem...ng-jee-2.5.xsd) and jee:jndi-lookup does not accept a business-interface attribute but rather a proxy-interface attribute, which isn't surprising since it's not specialized in EJB lookups.

        Comment

        Working...
        X