EJBs: review

As a reminder, and Enterprise JavaBean has a minimum of three classes, the remote interface, the home interface, and the bean implementation. The remote interface is the class that exposes the methods of the EJB to the outside world. In the example, the remote interface is the class org.jboss.docs.interest.Interest. The home interface specifies how to create a bean that implements the remote interface. In this example, the home interface is org.jboss.docs.InterestHome. The bean implementation provides an implementation of the methods specified by the remote and home interfaces. In this example, the Bean class is org.jboss.docs.interest.InterestBean.

Of course, a Bean can include other classes, or even other packages, but the classes listed above are the minimum. The classes must be packaged into a JAR archive with a directory structure that reflects the hierarchy of packages. In the example, the classes are in the package org.jboss.docs.interest, so they need to be in the directory org/jboss/docs/interest/ which is what you will find in the examples distribution.

You the ejb-jar archive is created there must be a directory called META-INF to store the deployment descriptor (always called ejb-jar.xml) and -- optionally -- another XML file to tell the server about application specific server infomormation. With JBoss, this file must be called jboss.xml.