Discussions

EJB design: Difference Normal Client and Application Client

  1. Difference Normal Client and Application Client (3 messages)

    Hi all,
    I wrote a normal java class that uses
    a remote reference of a Session Bean.
    In lookup() call I used the JNDI name of
    the session bean (lookup("myBean")).
    Everything was ok (client used succesfully
    the session bean).

    The question is: when I transform the normal client
    into an application client have I to change
    the lookup() call using a jndi name like
    "java:comp/env/ejb....." ?

    What are advantages of using an application
    client than using a normal client ?

    Thanks in advance
    Moreno
  2. It is not clear to me what is an "application" or "normal" client...

    However, you can use the "java:comp" JNDI when you reference "local" objects, the objects you have declared in ejb-ref element of the deployment descriptor. They are useful since every bean has a "private" namespace.

    The "public" JNDI names are normally used by clients.

    Hope this helps
  3. Hi Andrea (o Ciao Andrea :-) ?)

    I thought, but I don't know if I'm right,
    that if you create an application client and
    you put it in the same .ear file of your j2ee application
    (server side) then your application client can refer to your
    application server like a local client does
    (without having to specify, in InitialContext()
    method, the URL of the application server, and
    using the "java:comp/ejb/...." syntax for lookup()
    method).

    Thanks
    Moreno
  4. Hi Andrea (o Ciao Andrea :-) ?)


    Ciao

    if your client runs inside the application server (it sounds strange to me...) you can get the initial context using InitialContext but you can't use java:comp JNDI prefix since they are used only to get resources and beans referenced in the deployment descriptor. It will work only if your "client" is a EJB.