Discussions

EJB programming & troubleshooting: Home and Remote interface class files on client machine.

  1. Hi,
    I have a EJB on an Application server(webLogic 4.5). I am running a client on my machine.

    Here is the client code segment for JNDI look up..

    ############################################################

    public class RemoteAccessTestBeanTestClient1 {

      private RemoteAccessTestHome remoteAccessTestHome = null;
      private RemoteAccessTest remoteAccessTest = null;

      public RemoteAccessTestBeanTestClient1() {
        try {

          remoteAccessTestHome= (RemoteAccessTestHome) JNDIConfiguration.getEJBHome("RemoteAccessTestHome");

          remoteAccessTest = remoteAccessTestHome.create();

          System.out.println(remoteAccessTest.getClass().getName());
        }
        catch(Exception e) {
          System.out.println("Exception: " + e);
        }
      }

      public static void main(String args[]) {
        RemoteAccessTestBeanTestClient1 c =
                new RemoteAccessTestBeanTestClient1();
      }
    }
    ############################################################

    Now, when I do a JNDI look up on EJB home interface, I cast the return value to <B>RemoteAccessTestHome</B> class. The same, when I do a create to get Remote interface.

    This means I should have the class files for both Home and Remote interface at the client end.

    Is this the correct way to implement? any suggestion as to how I can do away with out putting these class files on the client end and still use EJBs on the remote machine?

    Thanks for all the help..

    Sunil
  2. Hi Sunil,

    You are right u need to import your home and remote interface classes at yr client machine..Thats all ...Stub is exported itself to client machine at run time.so u dont need to do that

    Bye
  3. Hi,
       Is the stub always exported on the client side in all the application servers or is it application server specific. Weblogic server sends the stubs to the client. What about the other servers?

    Ashutosh
  4. I think when you try to deploy the client jar file, the stub file should be include in the jar file.
  5. I also do not know how to enablement the
    distributed method calling . Who can tell
    me the detail .
    (I learned the COM+ of MS , it can easily
    be installed in Client and Server .)

    Thanks for your help.
    greenhorse
  6. Hi tiger,

    No u dont need to put the stub in the client jar..It gets automatically exported to the client when u do a JNDI lookup

    Bye
    Rinku