Chapter 22. Building an EJB

In this chapter we write a very simple EJB and compile it.

What You Will Learn

  • What a simple EJB example looks like.

  • What are the several pieces that you need to make an EJB.

  • How to compile the pieces of an EJB.

You’ll find the full text of our example on the book’s Web site at We will only use code excerpts in this chapter.

EJBs: You Don’t Know Beans?

Enough theory about EJBs and naming services and the like. It’s time to put together an actual EJB so you can see one run. First we need to write our EJB classes, then compile them. Then, in the next chapter, we’ll package them, along with other supporting information, into an EAR file. But let’s begin by writing some Java classes.

It’s not that ...

Get Java™ Application Development on Linux® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.