Pramati Technologies

Preparing Archives for Deployment

Application Assemblers assemble enterprise Java applications from JavaServer Pages, Taglibs, Servlets and Enterprise JavaBean components. Packaging standards make the application portable for deployment on any J2EE application server.

Studio Package Tool provides a mechanism to package the application components and generates the standard specification defined XML based deployment descriptors.

Components Packaged

Web and EJB components are packaged separately into Web Archives (.war files) and Java Archives (.jar files). JARs and WARs are assembled into an EAR. All the components can be deployed independently.

Java Archives (JARs)

The ejb-jar file must contain the deployment descriptor. The deployment descriptor must be stored with the name META-INF/ejb-jar.xml in the ejb-jar file.

For each enterprise bean, the ejb-jar file must include the class files of the following:

The ejb-jar file must also contain the class files for all the classes and interfaces that the enterprise bean class, and the remote and home interfaces depend on. This includes their super-classes and super-interfaces, and the classes and interfaces used as method parameters, results, and exceptions.

An ejb-jar file does not have to include the class files of the home and remote interfaces of an enterprise bean that is referenced by an enterprise bean in the ejb-jar, or other classes needed by the referenced enterprise bean.

Web Archives (WARs)

A Web Archive is an assembly of Web components that is deployed on the web server. It consists of one or more of the following:

A Web application is rooted at a specific path within a Web server. The URL by which a Servlet is known on the J2EE platform depends on the J2EE application in which it was deployed, so for reasons of robustness, servlets that call one another must be packaged and deployed together.

Since a WAR is typically deployed under its own context root, static content that is cross-linked has to be packaged in a single .war file to avoid broken links. Static content is also typically reusable.

Tag Libraries (Taglibs)

A tag library (taglib) is a collection of custom actions described by a tag library descriptor and Java classes. They are portable and can be used in any JSP Page regardless of the scripting language used in that page. It consists of one or more of the following:

Enterprise Archives (EARs)

The EJB and Web components are created and assembled into JARs and WARs. JARs, WARs and EARs can all be deployed independently. JARs and WARs are assembled into EAR files. This assembled application is then deployed in a target Server environment. The EAR consists of one or more JARs and WARs, and an XML deployment descriptor.

Deployment Descriptors

Deployment Descriptors are critical for any archive. They are stored in the eXtensible Markup Language format and provide both the structural and assembly information (information not included directly in the code) meant for the use of the particular archive - JAR, WAR, and EAR files. Accordingly, there are different types of deployment descriptors: JAR deployment descriptor, WAR deployment descriptor, and EAR deployment descriptor. The deployment descriptors describe:

Creating JARs, WARs, Taglibs And EARs

There are two ways to create JARs, WARs, Taglibs and EARs

When New is clicked, a new Java archive is created in the JAR folder that is specified. To the archive, it is possible to:

For packaging into a WAR, when New is clicked, a new Web archive is created. This file is then added to the WAR folder specified at the time of creation. The archive will consist of Servlets, classes, security constraints, the XML deployment descriptor file, and related static content.

In the archive, add Servlets, JavaServer Pages, Taglibs, Classes, Security Constraints, JARs containing supporting classes, and static content files.

Follow a similar procedure to create a new Taglib by clicking on Taglib > New. For packaging into an EAR file, when New is clicked, a new Enterprise archive is opened. As soon as it is saved, it gets added to the EAR folder specified at the time of creation. In the archive, it is possible to:

Only JARs and WARs that are present in active Desk can be added to an EAR. To add an "external" JAR or WAR to the EAR, first import it on to the Desk.

Opening JARs, WARs, Taglibs And EARs

Jar/WAR/Taglib/EAR > Open > Choose../Archive Name

Clicking on Choose pops up the dialog box where the JARs/WARs/EARs/ Taglibs are selected. Checking the All Files checkbox selects all the available files.

It is also possible to open an archive file in the Package Tool by double clicking on the required node on the Desk. If a JAR being opened is corrupt, classes required for loading a bean may not be found. These bean entries are removed from the XML in the JAR and need to be added again.

A JAR can be corrupt if it does not have all the necessary classes needed to load the beans or if the XML in the JAR not been created properly. If such a JAR is opened, a dialog box pops up and the list of corrupt entries in the JAR are displayed. Select the entries to be removed from the JAR. These have to be added back to the JAR to create a well-formed JAR.

Setting Icons and Displaying Names

The displayed names of the JARs, WARs, Taglibs and EARs can be modified using the Display Name textfield. This name will now be the superseded name of the opened file and will be reflected on the tree node corresponding to the opened archive.

It is also possible to set new icons for the archives. Either the small or the large icon can be opted for, by selecting the relevant icon from the file-system. The corresponding icon will then be displayed in the tree beside the file name. Some of the other details shown in the window that can all be sorted are:

Sorting can be performed on multiple columns by pressing shift and clicking on the next column you want to sort.

Example

To sort by both Path and Name, click on the path header and then press shift and click on the name Header.

Saving the Currently Opened Archives

Archive > Save All

All the archives that are currently open are saved using this command.

Archive > Save & Exit

Saves all the currently opened archives and then exits from the package tool. Closing the tool also achieves the same as Save and Exit.


Pramati Technologies  © Copyright   TOCPREVNEXTINDEX