2 Replies Latest reply on Mar 27, 2006 4:57 AM by lalala

    Using external EJB reference

    lalala Newbie

      I 'm developing an application that needs two JBoss. Now I'm using JBoss 4.0.1sp1. A Session A of one jboss must be access to another Session B of the other jboss.

      I was done:

      <ejb-jar>
      <enterprise-beans>


      <ejb-name>Bean A</ejb-name>
      AHome
      A
      <ejb-class>ABean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
      <ejb-ref>
      <ejb-ref-name>ejb/myBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      BHome
      B
      </ejb-ref>


      </enterprise-beans>
      </ejb-jar>

      jboss.xml:


      <enterprise-beans>

      <ejb-name>Bean A</ejb-name>
      <ejb-ref>
      <ejb-ref-name>ejb/myBean</ejb-ref-name>
      <jndi-name>jnp://otherserver/application/beanB</jndi-name>
      </ejb-ref>

      <enterprise-beans>


      I haven't maken changes in my java code, so since bean A I want to access to bean b doing:
      PortableRemoteObject.narrow(new InitialContext().lookup("ejb/myBean"), BHome.class);
      but the result at deploy is an Exception : javax.naming.NameNotFoundException ejb/myBean not bound

      If I put the string "jnp://otherserver/application/beanB" at lookup method it works fine, but this is at java code! and it isn't good!

      Is there any solution? How I can put in lookup de ejb-ref-name and the jboss take de jndi-name to find it?

      A lot of thanks!

      mery