1 Reply Latest reply on Oct 24, 2001 5:40 AM by Ben

    deployment and ejb jars

    simon Newbie

      hi - can someone advise me on this -

      if I have two separate ejbs in different jars, both deployed to the deploy folder, and I want to reference bean B from bean A, is there another way to do this than to use the classical

      InitialContext jndiContext = new InitialContext();

      Object bRef = jndiContext.lookup("B");

      BHome bHome = (BHome)

      javax.rmi.PortableRemoteObject.narrow (bRef, B.class);
      


      When both beans are within the same jar, I can simply declare a reference to the bean and invoke methods upon it. Perhaps the two beans could be deployed in another way to enable them to stay in separate jars but to be more accessible to each other ?

      thanks





        • 1. Re: deployment and ejb jars
          Ben Newbie

          On your second point, separate deployment jars, try the tips in the following discussion...

          http://www.jboss.org/modules/bb/index.html?module=bb&op=viewtopic&t=forums/ for your first point, the need to perform lookups, I think that this is a necessary part of working with EJB's. EJB's conform to a contract between the container and the bean that specifies that lookups and remote invocation are the proper route to bean access. The container than adds security, transactions, resource access etc on top to reduce the time it takes to create enterprise applications. You could replace the beans with standard java objects, but you loose the services provided by the container.

          If anyone disagrees with my interpretation, please jump in.

          Cheers

          Ben