Java Reference
In-Depth Information
hide behind the tool, you never fully understand what is happening. It looks
too much like magic, and you're helpless if the magic fails. Secondly, seeing
how it works inside out gives you a better understanding of what is going on
and even empowers you to do a custom version for your project. If this discus-
sion sounds familiar, it may be because you read something similar about IDEs
in Chapter 10.
23.2
L END M E Y OUR EAR: E NTERPRISE P ACKAGING AND D EPLOYMENT
There are lots of pieces that are needed to make Enterprise JavaBeans (EJBs)
work—not only the classes and interfaces that we have defined, but supporting
classes and other Web application pieces (e.g., JSP files) as well. They all have
to be in the right place. The distributed nature of EJBs means that we need a
way to distribute them across (potentially) several machines. And its not just a
matter of putting a single Enterprise JavaBean on a single host. A single bean
is typically part of a larger collection of classes and other files (properties, im-
ages, JSP, HTML) that work together to make an application. The mechanism
to manage all this is the Enterprise Archive, or EAR file.
Let's take a look inside an EAR and examine its pieces. Knowing what
it's made of will make an EAR look less intimidating, but will also help us
understand what we'll need for our application.
TIP
An EAR file (whose name ends with .ear ) is nothing more than a JAR file with
particular expected contents. So you can easily look inside an EAR with the jar
command. Use the -tvf options for table of contents, verbose, and file
(meaning that the next argument is the filename).
The budgetpro.ear file will be our example. We haven't yet discussed
building this file, but let's peek ahead, to see how it will be put together
(Example 23.1).
Notice that, at the top level, there are two files and a directory, and inside
the directory there are two other files (Table 23.1).
From the standpoint of building an EAR yourself, you need to create all
the files listed in Table 23.1 and then put them all together into a JAR file. So
we need to understand those pieces.
Search WWH ::




Custom Search