13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

506Chapter 23Deploying EJBshide behind the tool, you never fully understand what is happening. It lookstoo much like magic, and you’re helpless if the magic fails. Sec<strong>on</strong>dly, seeinghow it works inside out gives you a better understanding of what is going <strong>on</strong>and even empowers you to do a custom versi<strong>on</strong> for your project. If this discussi<strong>on</strong>sounds familiar, it may be because you read something similar about IDEsin Chapter 10.23.2LEND ME YOUR EAR: ENTERPRISE PACKAGING AND DEPLOYMENTThere are lots of pieces that are needed to make Enterprise JavaBeans (EJBs)work—not <strong>on</strong>ly the classes and interfaces that we have defined, but supportingclasses and other Web applicati<strong>on</strong> pieces (e.g., JSP files) as well. They all haveto be in the right place. The distributed nature of EJBs means that we need away to distribute them across (potentially) several machines. And its not just amatter of putting a single Enterprise JavaBean <strong>on</strong> a single host. A single beanis typically part of a larger collecti<strong>on</strong> of classes and other files (properties, images,JSP, HTML) that work together to make an applicati<strong>on</strong>. The mechanismto manage all this is the Enterprise Archive, or EAR file.Let’s take a look inside an EAR and examine its pieces. Knowing whatit’s made of will make an EAR look less intimidating, but will also help usunderstand what we’ll need for our applicati<strong>on</strong>.TIPAn EAR file (whose name ends with .ear) is nothing more than a JAR file withparticular expected c<strong>on</strong>tents. So you can easily look inside an EAR with the jarcommand. Use the -tvf opti<strong>on</strong>s for table of c<strong>on</strong>tents, verbose, and file(meaning that the next argument is the filename).The budgetpro.ear file will be our example. We haven’t yet discussedbuilding 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 insidethe directory there are two other files (Table 23.1).From the standpoint of building an EAR yourself, you need to create allthe files listed in Table 23.1 and then put them all together into a JAR file. Sowe need to understand those pieces.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!