« Oracle launched EJB 3.0 microsite | Main | Generate JavaHelp Content with JDeveloper »

OC4J Startup Order in J2EE Application, II.

A comment on my first installment on this blog was asking for a sample for loading particular EJB modules.

Well, there is no "rocket science" behind this, but the usual client lookup of the Enterprise Java Beans or any other J2EE services you need.

In it's simplest incarnation it might look like this code snippet:


public static void main(String[] args) {
// ...
InitialContext ctx = new InitialContext();
Object obj = ctx.lookup("MyEJB");
MyEJBHome home = (MyEJBHome)PortableRemoteObject.narrow(obj, MyEJBHome.class);
MyEJB bean = home.create();
// ...
}

For Servlets a simple URL, URLConnection combination works in the same fashion.

However, I prefer to use the same utilities like ServiceLocator et al in the application client as I use them in the J2EE application.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

About This Entry

This page contains a single entry from the blog posted on May 2, 2005 3:27 PM.

The previous post in this blog was Oracle launched EJB 3.0 microsite.

The next post in this blog is Generate JavaHelp Content with JDeveloper.

Many more can be found on the main index page or by looking through the archives.

Top Tags

Powered by
Movable Type and Oracle