7) packaging and deployment


Published on

Published in: Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

7) packaging and deployment

  1. 1. Vikas Manoria IT Specialist – IBM Academic Initiative [email_address] m Section - 7) Packaging and Deployment
  2. 2. Section 7 - Packaging and Deployment (9%) <ul><li>Create J2EE projects </li></ul><ul><li>Import and export J2EE modules </li></ul><ul><li>Create and locate resources in the appropriate location of the project hierarchy </li></ul><ul><li>Work with Web and Application Deployment Descriptor Editors </li></ul>
  3. 3. What is J2EE? <ul><li>Enterprise application development Specification </li></ul><ul><li>Platform for </li></ul><ul><ul><li>developing, deploying and managing </li></ul></ul><ul><ul><li>n-tier ,web-enabled ,server centric and component based enterprise application </li></ul></ul>
  4. 4. J2EE Architecture
  5. 5. J2EE Multi-tier Model
  6. 6. J2EE Perspective Project Explorer Code Editor Resource Views
  7. 7. Associating Projects with a Server <ul><li>There are several ways to associate a project with a server: </li></ul><ul><ul><li>From the project context pop-up menu, select Run As > Run on server </li></ul></ul><ul><ul><ul><li>You will be able to choose a server in the dialog, and associate the project with that server </li></ul></ul></ul><ul><ul><li>From the server context pop-up menu in the Servers view, select Add and Remove Projects… </li></ul></ul><ul><ul><ul><li>The server will be started in order to add or remove projects </li></ul></ul></ul><ul><ul><li>From the project context pop-up menu, select Properties > Server </li></ul></ul><ul><ul><ul><li>From here, you can set the runtime target and the default server </li></ul></ul></ul>
  8. 8. J2EE Packaging <ul><li>The J2EE specification defines standard archive formats for all J2EE components </li></ul><ul><ul><li>EJB module </li></ul></ul><ul><ul><ul><li>Packaged in a Java archive (.jar) file </li></ul></ul></ul><ul><ul><li>Web module </li></ul></ul><ul><ul><ul><li>Packaged in a Web archive (.war) file </li></ul></ul></ul><ul><ul><li>Application client module </li></ul></ul><ul><ul><ul><li>Packaged in a Java archive (.jar) file </li></ul></ul></ul><ul><ul><li>Resource adapter module </li></ul></ul><ul><ul><ul><li>Packaged in a resource adapter archive (.rar) file </li></ul></ul></ul><ul><ul><li>Enterprise application </li></ul></ul><ul><ul><ul><li>Packaged in an enterprise archive (.ear) file </li></ul></ul></ul>
  9. 9. J2EE Packaging – Containment Hierarchy web resource JSP Servlet client1.jar web1.war res1.rar EJB client class native library adapter jar ejb1.jar app1.ear ejb-jar.xml application-client.xml web.xml web resource JSP Servlet ejb1.jar client1.jar web1.war res1.rar ra.xml EJB client class native library adapter jar application.xml
  10. 10. EJB Module <ul><li>An EJB module is contained in an EJB jar file </li></ul><ul><li>Several beans may be packaged within a single EJB jar file </li></ul><ul><li>The EJB JAR contains all the classes required for each EJB </li></ul><ul><ul><li>The enterprise bean class </li></ul></ul><ul><ul><li>The enterprise bean home and component interfaces </li></ul></ul><ul><ul><li>The primary key class if the bean is an entity bean </li></ul></ul><ul><li>The deployment descriptor (ejb-jar.xml) contains: </li></ul><ul><ul><li>EJB structural information </li></ul></ul><ul><ul><ul><li>Defining the class names, external dependencies, persistent fields and relationships (for CMP beans) </li></ul></ul></ul><ul><ul><li>Application assembly information describing how the EJBs fit into a wider application </li></ul></ul><ul><ul><ul><li>Security information and transaction attribute </li></ul></ul></ul>
  11. 11. Web Module <ul><li>Web modules (also known as Web applications) are contained in a Web archive (.WAR) file </li></ul><ul><li>A WAR file will normally contain several Servlets, JavaServer Pages and other Web resources </li></ul><ul><ul><li>For example, a Web application may contain HTML files, graphics files, audio files and movies </li></ul></ul><ul><li>The deployment descriptor (web.xml) contains configuration information for resources contained in the war file </li></ul><ul><ul><li>For example, initialization parameters, session management configuration, Servlet declarations and mappings, filter definitions, welcome file list, and error pages </li></ul></ul><ul><ul><li>Security information, tag libraries, and JNDI configuration may also be provided </li></ul></ul>
  12. 12. Application Client Module <ul><li>Application clients are contained in jar file </li></ul><ul><li>An application client JAR file contains all the classes required for the client to function </li></ul><ul><li>The deployment descriptor (application-client.xml) contains configuration information for the client </li></ul><ul><ul><li>The enterprise beans and external resources referenced by the application client </li></ul></ul><ul><li>The mechanism for deployment and installation of the application client is not specified in the J2EE specification </li></ul><ul><li>J2EE product providers may provide an application launcher that integrates with the application client machine’s native operating system </li></ul>
  13. 13. Resource Adapter Module <ul><li>Resource adapters are contained in a resource adapter archive (.RAR) file </li></ul><ul><li>A resource adapter archive RAR file contains: </li></ul><ul><ul><li>Java code for the resource adapter </li></ul></ul><ul><ul><li>Utility Java classes for the resource adapter </li></ul></ul><ul><ul><li>Platform-dependent native libraries required by the resource adapter </li></ul></ul><ul><ul><li>Help files and documentation </li></ul></ul><ul><li>The deployment descriptor (ra.xml) contains: </li></ul><ul><ul><li>General information on the adapter </li></ul></ul><ul><ul><li>The class names of the connection factory and implementation class </li></ul></ul><ul><ul><li>Transaction and security information </li></ul></ul>
  14. 14. Enterprise Application <ul><li>Enterprise applications are contained in an enterprise archive (.ear) file </li></ul><ul><li>An enterprise archive file contains one or more J2EE modules </li></ul><ul><ul><li>EJB jars, wars, application client jars and rars </li></ul></ul><ul><li>The enterprise application deployment descriptor (application.xml) contains: </li></ul><ul><ul><li>Details of all the modules packages in the ear file </li></ul></ul><ul><ul><li>Definitions of security roles for the enterprise application </li></ul></ul>
  15. 15. Relationship between Projects and J2EE Packages <ul><li>In J2EE V1.4 there are four application component types supported by the runtime environment: </li></ul><ul><ul><li>Application Clients </li></ul></ul><ul><ul><li>Applets </li></ul></ul><ul><ul><li>Web applications (servlets, JSPs, and HTML pages) </li></ul></ul><ul><ul><li>EJBs </li></ul></ul><ul><li>J2EE components are packaged for deployment as modules: </li></ul><ul><ul><li>Application client module </li></ul></ul><ul><ul><li>Web application module </li></ul></ul><ul><ul><li>EJB module </li></ul></ul><ul><ul><li>Resource adapter module </li></ul></ul><ul><li>Rational Application Developer projects map to J2EE packages </li></ul>
  16. 16. J2EE Packaging Structure Review Web DD EJB Module JAR file Web Module WAR file Client Module JAR file J2EE Application EAR file Installed RARs IBM Bind Schema Map Schema Attributes Table Creation was.policy (Java2 Sec) IBM Bind/Ext HTML, GIFs, and so on Servlet JSP Application DD Client Classes EJBs IBM Bind/Ext IBM Bind/Ext EJB DD Client DD RA DD
  17. 17. Data Sources Defined in Enhanced EAR <ul><li>Application-related properties and data sources can be defined within an application to simplify application deployment </li></ul><ul><ul><li>Configuration files added to the J2EE EAR file as an IBM extension </li></ul></ul><ul><li>Properties are used when application is installed </li></ul><ul><li>Data source is registered with the WebSphere V6.1 server when the application is started </li></ul><ul><li>Configuration variables can be defined for substitution with server values when application is installed </li></ul>Enhanced EAR Properties J2EE Enterprise Application (EAR) Components Components Resources
  18. 18. Other Properties Defined in the Enhanced EAR 1 2 3 4 5 6 7
  19. 19. Exporting Web Applications <ul><li>A Web application can be exported in two ways using the context menu: </li></ul><ul><ul><li>As an EAR file </li></ul></ul><ul><ul><li>As a WAR file </li></ul></ul>
  20. 20. Sharing Projects between Workspaces <ul><li>Project Interchange is an export feature that allows the export of entire projects. </li></ul><ul><li>The project structure is maintained, including metadata files. </li></ul><ul><ul><li>Unlike exporting a WAR, where you may lose metadata. </li></ul></ul><ul><li>Unrelated projects can be exported. </li></ul><ul><ul><li>You can then easily import the projects into another workspace with a single action. </li></ul></ul>
  21. 21. Publishing Applications <ul><li>Application Developer supports: </li></ul><ul><ul><li>WebSphere test environment in the development environment </li></ul></ul><ul><ul><li>Tomcat test environment in the development environment </li></ul></ul><ul><ul><li>WebSphere local or remote server outside the development environment </li></ul></ul><ul><ul><li>Tomcat local server outside the developer environment </li></ul></ul><ul><ul><li>J2EE Web publishing server </li></ul></ul><ul><ul><li>Static Web publishing server </li></ul></ul>
  22. 22. Publishing Applications <ul><li>The server tools provide several publishing methods that you can use when publishing projects and files. </li></ul>Server Status Server Name and Type
  23. 23. Checkpoint <ul><li>What are the four application component types supported by the runtime environment? </li></ul><ul><li>What are the four modules used to package J2EE components? </li></ul><ul><li>Name two components of the WAR file. </li></ul><ul><li>You have a static Web project. Which archive can you use to export it: WAR or EAR? </li></ul><ul><li>What is one of the most common uses of the enhanced EAR? </li></ul><ul><li>What is the difference between exporting in .zip format and in project interchange format? </li></ul>
  24. 24. Checkpoint answers <ul><li>The four application component types supported by the runtime environment: </li></ul><ul><ul><li>Application Clients, Applets, Web applications (servlets, JSPs, HTML pages, and so on), and EJBs </li></ul></ul><ul><li>The four module types used to package J2EE components: </li></ul><ul><ul><li>Application client module, Web application module, EJB module, and Resource adapter module </li></ul></ul><ul><li>Servlets, JSPs, HTML pages, and Web Deployment Descriptor </li></ul><ul><li>WAR </li></ul><ul><li>Substitution variables, authentications, shared libraries, virtual hosts, class loader mode, WAR class loader policy, and start weight. </li></ul><ul><li>The project interchange format preserves the metadata. </li></ul>
  25. 25. Checkpoint <ul><li>What is an EAR? </li></ul><ul><li>What are the four types of modules contained in an EAR? </li></ul><ul><li>What are the three types of archives contained in an EAR? </li></ul><ul><li>Which archive type contains servlets and JSP pages? </li></ul>
  26. 26. Checkpoint solutions <ul><li>Enterprise Archive </li></ul><ul><li>EARs can contain the following modules: </li></ul><ul><ul><li>EJB </li></ul></ul><ul><ul><li>Web </li></ul></ul><ul><ul><li>Resource Adapter </li></ul></ul><ul><ul><li>Client Application </li></ul></ul><ul><li>The three types of archive files are: </li></ul><ul><ul><li>WAR (Web Archive) </li></ul></ul><ul><ul><li>RAR (Resource Archive) </li></ul></ul><ul><ul><li>JAR (Java Archive) </li></ul></ul><ul><li>WAR </li></ul>
  27. 27. Japanese Hebrew Thank You English Merci French Russian Danke German Grazie Italian Gracias Spanish Obrigado Portuguese Arabic Simplified Chinese Traditional Chinese Thai Korean