|
Home TOC Index |
|
Search
Feedback |
Packager Tool
The
packagertool is a command-line script that enables you to package J2EE components. This tool is for advanced users who do not want to usedeploytoolto package J2EE components. Withpackager, you can create the following component packages:
- EJB JAR file
- Web application WAR file
- Application client JAR file
- J2EE application EAR file
- Resource adapter RAR file
The
packagertool also enables you to set the runtime deployment information of an application EAR file.
Note: To make them easier to read, the examples that follow contain line breaks within the commands. When typing these commands, do not include the line breaks.
EJB JAR File
Syntax
packager -ejbJar <root-directory> <file-list> <ejb-dd> <ejb-jar>Example
The following command packages the three
Helloclasses and thehello-jar.xmldeployment descriptor into theHelloEJB.jarfile:packager -ejbJar /home/duke/classes/ HelloHome.class:HelloEJB.class:HelloRemote.class hello-jar.xml HelloEJB.jarWeb Application WAR File
Syntax
packager -webArchive [-classpath <root-directory> [-classFiles <file-list>]] <content-root> [-contentFiles <file-list>] <web-dd> <web-war>Example
The following command packages helper classes and JSP
pages into the
bookstore2.warfile:packager -webArchive -classpath . -classFiles cart\ShoppingCart.class:cart\ShoppingCartItem.class: database\BookDB.class:util\Currency.class . -contentFiles banner.jsp:bookdetails.jsp:bookstore.jsp:cashier.jsp: catalog.jsp:DigitalClock.class:duke.books.gif: errorpage.jsp:initdestroy.jsp:receipt.jsp:showcart.jsp web.xml bookstore2.warApplication Client JAR File
Syntax
packager -applicationClient <root-directory> <file-list> <main-class> <appclient-dd> <appclient-jar>Example
The following command creates the
appClient.jarfile:packager -applicationClient classes hola:hello/HelloUtil.class package.Main client.xml appClient.jarJ2EE Application EAR File
Syntax
packager -enterpriseArchive <file-only-list> [-alternativeDescriptorEntries <file-only-list>] [-libraryJars <file-list>]<app-name> <app-ear>Example
In the following command, the optional
-alternativeDescriptorEntriesflag allows you to specify the external descriptor entry name of each component as you wish it to appear in the EAR file:packager -enterpriseArchive myWeb.war:myEJB.jar:appClient.ear -alternativeDescriptorEntries myWeb/web.xml:myEjb/myEjb.xml:client/client.xml myAppName myApp.earSpecifying the Runtime Deployment Descriptor
The preceding example specified the
-enterpriseArchiveflag to create a portable J2EE application EAR file. This file is portable because you can import it into any J2EE environment that conforms to the J2EE Specification. Although you can import the file into thedeploytool, you cannot deploy it on the J2EE server until it contains a runtime deployment descriptor. This deployment descriptor is an XML file that contains information such as the JNDI names of the application's enterprise beans.Syntax
packager -setRuntime <app-ear>|<appclient-jar><runtime.xml>[-o <output-file>]Example
In the following command, the
-setRuntimeflag instructspackagerto insert the runtime deployment descriptor (sun-j2ee-ri.xml) into themyApp.earfile:packager -setRuntime MyApp.ear sun-j2ee-ri.xmlThe following command copies
MyApp.eartoOtherApp.ear, inserts the deployment descriptor into theOtherApp.earfile, and leavesMyApp.earunchanged:packager -setRuntime MyApp.ear sun-j2ee-ri.xml -o OtherApp.earTo obtain an example of the runtime deployment descriptor, extract it from an EAR file that you've already deployed:
jar -xvf SomeApp.earThe DTD of the runtime deployment descriptor is in the
lib/dtds/sun-j2ee-ri-dtdfile of your J2EE SDK installation.
Note: The runtime deployment descriptor (sun-j2ee-ri-<version>.xml) is not required by the J2EE Specification. This descriptor is unique to the J2EE SDK and may change in future releases.
Resource Adapter RAR File
Syntax
packager -connector <root-directory> <file-list> ra.xml myConnector.rarExample
In this example, the
jarcommand packages the files under thecomdirectory intomyfiles.jar. The packager command creates a RAR file namedtheConnector.rarthat containsmyfiles.jarand themyra.xmldeployment descriptor:jar -cvf myadapter.jar com packager -connector . myadapter.jar myra.xml theConnector.rar
|
Home TOC Index |
|
Search
Feedback |