
Chapter 11. Deployment Chapter 11. Deployment Table of Contents J2EEDeploymentPhases.......................................................................................................................................1 What Happens During Deployment? ...................................................................................................................... 3 ApplicationPackageRequirement.........................................................................................................................3 DeploymentDescriptorFiles........................................................................................................................4 DeploymentScenarios............................................................................................................................................4 TypesofDeployment.............................................................................................................................................6 DeploymentTools..................................................................................................................................................7 Deploying a Sample Application ............................................................................................................................ 8 This module describes deployment phases and scenarios, and Sun ONE Application Server deployment requirement. It also compares the different deployment types and tools available with Sun ONE Application Server and shows how to deploy a sample application using Administration GUI. Objectives • Identify J2EE deployment phrases and scenarios. • List the package requirement of an application to deploy to Sun ONE Application Server • Differentiate J2EE standard and Sun ONE Application Server deployment descriptors • Describe the deployment types and tools supported by Sun ONE Application Server • Deploy a sample application using Administration GUI J2EE Deployment Phases In J2EE specifications, deploying an application involves three phases: • Component creation, done by application developers. • Application assembly, done by possibly a different set of application developers. • Application deployment, done by developers and administrators. 1 Chapter 11. Deployment Component Creation Application developers create individual files and group them into modules. Each module includes an XML file called a deployment descriptor. This file describes the parameters needed to deploy the module's components. One type of module is called a .war file, which stands for web archive file. A .war file might contain components such as servlets, JSP files, and static files such as HTML and images. Another type of module is called a .jar file, which stands for Java archive file. This module is sometimes called an EJB .jar file because it contains the Java files that together make up an enterprise bean. Application Assembly Application developers assemble modules into an .ear file, which stands for enterprise archive file. An .ear file rep- resents an application. The various archive files—.war, EJB .jar, and .ear—all have the same format. They are all JAR files. The file suf- fixes differ so that you can distinguish the components they contain. These suffixes are mandated by the J2EE speci- fication. JAR is a file format based on the popular ZIP file format. In short, JAR files are .zip files. Application Deployment 2 Chapter 11. Deployment During development and testing, application programmers will most likely deploy their own applications. When an application is ready for production, administrators usually deploy it. Deployment tasks include the following: 1. Optionally configuring the .ear file. 2. Specifying the destination hosts and directories for the .ear file. 3. Running the deployment command (from a command line or from a GUI tool). What Happens During Deployment? When you deploy an application, its components are deployed to a container, which provides various services. A Sun ONE application is deployed as a set of nested units or modules. A module consists of one or more components for the same container type and one deployment descriptor of that type. In other words a module is the smallest, in- dependent deployable unit for a particular container and is often referred to as a deployment unit. Components A component is an application-level software unit. Component may be defined as the smallest, independent, soft- ware functional unit in a Sun ONE application server environment. A component may be a single class or a collec- tion of classes. Sun ONE application server platform supports the following types of components: EJB components, Web Components, applets, application clients or resource adapter components. For example, a component can be an EJB, a servlet, a JSP page, applet, an application client or a connector. Containers Containers provide services to the components. In other words, components depend on some runtime support, pro- vided by container. A component doesn’t exist on its own and it’s lifecycle is controlled by the container. Compo- nents communicate with each other and to the outside world, using the services of containers, such as lifecycle man- agement, theading, security etc. Services A component uses services provided by the container such as naming, deployment, transaction,and security. These services simplify application programming and allow components and applications to be customized at deployment time to use resources available in the deployment environment. Application Package Requirement Applications deployed to the Sun ONE AS must comply with standard J2EE packaging requirements. Refer to the J2EE specification and the Sun ONE Application Server documentation for details on packaging requirements. A packaged application is an EAR (Enterprise Archive) file that contains compiled Java classes, HTML pages, JSPs, and a number of XML-based deployment descriptors. These components are deployed to the appropriate container (WEB/EJB) for a server instance; the container provides additional runtime support for applications. Once deployed, the application is available to users. Other types of entities that can be deployed are WAR (Web Archive) and EAR (Enterprise Archive) files. All are in ZIP format and can be opened with any ZIP-compliant utility, like WinZip or the Unix zip/unzip utility. They are created with the App Server’s jar (Java Archive) utility, which can be executed by hand. 3 Chapter 11. Deployment A Sun ONE application is deployed as a set of nested units or modules. A module consists of one or more compo- nents for the same container type and one deployment descriptor of that type. In other words a module is the small- est, independent deployable unit for a particular container and is often referred to as a deployment unit. It is usually the developer’s job to package the application into an EAR file that can be deployed to a server instance. Deployment Descriptor Files A deployment descriptor is a plain text file, with a .xml extension which conforms to the XML standards. An application deployment descriptor, contains a list of the application’s modules and information on how to cus- tomize the application. Similarly, a component deployment descriptor contains declarative data to customize the component in the module. J2EE Standard Descriptors The J2EE platform provides assembly and deployment facilities. These facilities use JAR files as the standard pack- age for components and applications, and XML-based deployment descriptors for customizing parameters. The J2EE standard deployment descriptors are described in the J2EE specification, v1.3. Table below lists J2EE modules and their associated deployment descriptors: Table 11.1. J2EE Modules and Deployment Descriptors Module Deployment Descriptors EJB modules Contain enterprise java beans and an ejb ejb-jar.xml sun-ejb-jar.xml (optional) deployment descriptor. These are packaged as .jar files. Web modules Contain JSPs, servlets, image files, other web.xml sun-web.xml (optional) web related files and a web deployment descriptor. These are packaged as .war files. Resource Adapter modules Contain all java interfaces, ra.xml sun-ra.xml (optional) classes, native libraries and other documentation along with the resource adapter deployment descriptor. These are packaged as a .rar file. Application Client Modules Contain class files and an applicationclient.xml sunapplicationclient. xml application client deployment descriptor. These and are packaged as a .jar file. Sun ONE Application Server Descriptors The sun Deployment Descriptors extend the J2EE deployment descriptors by including Sun ONE Application Server-specific information necessary for deployment of the application on Sun ONE Application Server. If you de- ploy the application on a different platform, the Sun ONE Application Server-specific deployment descriptor files are essentially ignored (are not parsed). However, if these files are missing from the archive files, deployment on Sun ONE Application Server will fail. Deployment Scenarios Sun ONE Application Server supports application-based and module-based registration and deployment. For mod- ule-based registration and deployment, individual modules can be deployed independently of applications, allowing 4 Chapter 11. Deployment the developer to make an appropriate choice. Deployment by Module Individual module-based deployment is preferable when components need to be accessed by: • Other modules • J2EE Applications • RMI/IIOP clients (Module-based
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages12 Page
-
File Size-