How to use EJB from java client application?

Discussions

EJB programming & troubleshooting: How to use EJB from java client application?

  1. How to use EJB from java client application? (4 messages)

    Hello,
    can someone tell me how to call EJB from a java client application?
    Thanks
  2. How to use EJB from java client application?[ Go to top ]

    The easiest way is to provide a http gateway using a servlet that runs on the same app server as the EJBs and acts as the bridge between your client code(which I assume is a desktop application) and the EJBs.
  3. How to use EJB from java client application?[ Go to top ]

    thank you.
    is this method the best one?
    and do you have another method about it?
    thanks.
  4. How to use EJB from java client application?[ Go to top ]

    You can get a direct handle to the EJB from a application client. You just need to specify a few additional parameters in you InitialContext object. These are different for each app server. What server are you trying to talk with, maybe I have an example for you? Anyway, once you make the connection you do the lookup like normal, you have to narrow the returned object as it will be an RMI object that you get back, then you just use it like normal.

    MikeD

  5. It actually depend upon the type of Java application you are using. If it's a web application in JSP etc, it's better
    to talk to a gateway Servlet and let the servlet talk to the
    EJB. Then Java app will talk to Servlet in HTTP mode and Servlet and EJB will talk in RMI. That will be beneficial in places with firewalls etc.

    But if the Java application is nothing but a non-GUI applications, it's better to cut the servlet layer and talk directly to EJB by getting the Home from JNDI and creating the bean.

    Hope this helps.