Library Zone Articles
External Articles
Byte Size

Discovery Zone Catalogue
Interactive Zone Ask the Gurus
Discussion Groups
Etc Cartoons
Advertising ASP Web Ring ASP Web Ring - Jobs for Professional Developers
The Developer's Resource & Community Site
International This Week Forums Author Central Find a Job

EJB Components at the Server

EJB takes a high level approach for building distributed systems. It frees the application developer to concentrate on programming only the business logic, while removing the need to write all the "plumbing" code that is required in any enterprise application development scenario. For example, the enterprise developer no longer needs to write code that handles transactional behavior, security, connection pooling or threading, because the architecture delegates this task to the server vendor.

The current version of EJB bears little relation to "plain old vanilla" JavaBeans. However, the name "Enterprise JavaBeans" implies a relationship that doesn't really hold. Typically, JavaBeans are used in a manner similar to Microsoft ActiveX components (to provide user-friendly code with user interfaces), whereas EJBs are used to implement transactional middleware and are decidedly non-visual. Additionally, EJB does not include things like BeanInfo classes, property editors, or customizers either.

In essence, EJB is a server component model for Java and is a specification for creating server-side, scalable, transactional, multi-user and secure enterprise-level applications. Most importantly, EJBs can be deployed on top of existing transaction processing systems including traditional transaction processing monitors, web servers, database servers, application servers, etc.

Why use EJB?

In applications like Microsoft’s Visual Basic, there is a "Property Window" which can be used as a simple, code-free means of programming various objects that are part of an application. Similarly, PowerSoft’s PowerBuilder, has a "Data Window" which allows a code-free means of programming data access to database applications. EJB brings a similar concept to building enterprise applications. Users can now focus on developing business logic with ease, while being shielded from the nitty-gritty aspects of enterprise application development through the use of EJB components.

In an n-tier architecture it does not matter where the business logic is - though in a typical 3-tier architecture, the business logic is normally in the middle-tier by convention. However with EJB, you can now move your business logic wherever you want, while adding additional tiers if need be. The EJBs containing the business logic are platform-independent and can be moved to a different, more scalable platform should the need arise. If you are hosting a mission-critical application and need to move your EJBs from one platform to the other, you can do it without any change in the business-logic code. A major highlight of the EJB specification is the support for ready-made components. This allows you to "plug and work" with off-the-shelf EJBs without having to develop or test them or have any knowledge of their inner workings.

The primary advantages of going in for an EJB solution are:

  • EJB provide developers architectural independance - EJB insulates developers from the underlying middleware, since the only environment an EJB developer sees is the Java environment. It also helps the EJB server/container vendor to change and make improvements on the underlying middleware layer without affecting a user’s existing enterprise applications.
  • WORA for Server-side components - Since EJB is based on Java technology, both the developer and the user are guaranteed that their components are Write Once, Run Anywhere (WORA). As long as an EJB Server faithfully conforms to the EJB specification, any EJB application should run within that server.
  • EJB establishes Roles for Application Development - The EJB specification assigns specific roles for project participants charged with enterprise application development utilizing EJBs. For instance, Business Developers can focus on writing code that implements business logic. Deployers can take care of installation issues in a simple and portable fashion. The Server vendor can take care of providing support for complex system services and make available an organized framework for a Bean to execute in, without assistance from Bean developers.
  • EJB takes care of Transaction Management - The EJB container vendor is required to provide transaction control. The EJB developer who is writing the business functionality need not worry about starting and terminating transactions.
  • EJB provides Distributed Transaction Support - EJB provides transparency for distributed transactions. This means that a client can begin a transaction and then invoke methods on Beans present within two different servers, running on different machines, platforms or JVMs. Methods in one Bean can call methods in the other Bean with the assurance that they will execute in the same transaction context.
  • It helps create Portable and Scalable solutions - Beans conforming to the EJB API will install and run in a portable fashion on any EJB Server.
  • It seamlessly integrates with CORBA - EJB and CORBA are a natural combination that complements each other. For example, EJBs may provide CORBA/IIOP for a robust transport mechanism or pure CORBA clients can access EJBs as EJB clients. Currently, a highlight of OMG’s CORBAServices is the wide range of features they provide to an enterprise application developer. In future, rather than trying to rewrite these services, EJB server vendors may simply wrap them with a simplified API, so that EJB developers can use them without being CORBA.
  • It provides for vendor specific enhancements - Since the EJB specification provides a lot of flexibility for the vendors to create their own enhancements, the EJB environment may end up being feature rich.

What do you think of this article?

Have your say about the article. You can make your point about the article by mailing [email protected] (If you haven't allready joined, you can join by going to

You can also write a review. We will publish the best ones here on this article. Send your review to [email protected]. Please include the title of the article you are reviewing.

Further Reading

The Enterprise JavaBeans Series:

Enterprise Java Beans By Gopalan Suresh Raj.
In this introduction to Enterprise Java Beans, Gopalan covers the bases then goes on to demonstrate how to build server side business object components. This article is the introduction to Gopalans series of Enterprise JavaBeans articles. (This series of articles is courtesy of Gopalan Suresh Raj)

Enterprise Java Beans Series - EJB Model By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Naming Services and JNDI By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Transactions and JTS By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Lifecycle By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Servers By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Containers By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Components By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Session Beans By Gopalan Suresh Raj.

Enterprise Java Beans Series - EJB Entity Beans By Gopalan Suresh Raj.

Enterprise Java Beans Series - Writing an Entity Bean By Gopalan Suresh Raj.
Part 1 of a four part series: A four tier bank account example

Enterprise Java Beans Series - Writing a Session Bean By Gopalan Suresh Raj.
Part 2 of a four part series: A four tier bank account example

Enterprise Java Beans Series - Writing an EJB Client By Gopalan Suresh Raj.
Part 3 of a four part series: A four tier bank account example

Enterprise Java Beans Series - Writing an EJB Servlet Client By Gopalan Suresh Raj.
Part 4 of a four part series: A four tier bank account example

Author: Gopalan Suresh Raj

Gopalan has his own site at Author Central (visit him. He also maintains his own site at - Contribute to and you can have one too!

© Copyright 1997-2000 Gopalan Suresh Raj. Reproduced with Permission

Power your site with idr newswire

Contribute to IDR:

To contribute an article to IDR, a click here.

To contact us at, use our feedback form, or email us.

To comment on the site contact our webmaster.

Promoted by CyberSavvy UK - website promotion experts

All content © Copyright 2000, Disclaimer notice

WTL Architecture by Richard Grimes

Code Project

Visit our NEW WTL Section

WTL Introduction

Code Project