Date post: | 30-May-2018 |
Category: |
Documents |
Upload: | suresh1130 |
View: | 219 times |
Download: | 0 times |
of 40
8/14/2019 15_Deploying JavaEE Applications
1/40
15Copyright 2007, Oracle. All rights reserved.
Deploying Java EE Applications
8/14/2019 15_Deploying JavaEE Applications
2/40
15-2 Copyright 2007, Oracle. All rights reserved.
Objectives
After completing this lesson, you should be able to dothe following: Describe deployment archive files
Develop deployment descriptors for Java EEcomponents
Describe Oracle Application Server Containers for Java EE (OC4J) architecture
Deploy Java EE applications to Oracle ApplicationServer 10 g
8/14/2019 15_Deploying JavaEE Applications
3/40
15-3 Copyright 2007, Oracle. All rights reserved.
Java EE Server
The Java EE server provides: Containers for each component type of a Java EE
application
System-level services to components: Naming and directory services (JNDI) Security services for Web components and
Enterprise JavaBeans (JAAS) Transaction architecture (JTA) Remote client connectivity:
Enterprise beans (RMI/IIOP, ORMI)Servlet/JSP (HTTP, HTTPS, FTP)
8/14/2019 15_Deploying JavaEE Applications
4/40
8/14/2019 15_Deploying JavaEE Applications
5/40
15-5 Copyright 2007, Oracle. All rights reserved.
Java EE Application Assembly andDeployment
A Java EE application is packaged into one or morestandard units for deployment to any Java EEplatformcompliant system. Each unit contains:
A functional component or components (EJB, JSP,servlet, and so on) An optional deployment descriptor that describes
its content
8/14/2019 15_Deploying JavaEE Applications
6/40
15-6 Copyright 2007, Oracle. All rights reserved.
Planning the Deployment Process
The deployment process includes: Packaging code as Java EE applications or
modules Selecting a parent application
Binding the Web application to a Web site Creating and applying a deployment plan Deploying the application or module
1 2 3 4 5
EAR file Select parentapplication
Bind to URL Deploymentplan
Deployedenvironment
Parent
Deploy
8/14/2019 15_Deploying JavaEE Applications
7/4015-7 Copyright 2007, Oracle. All rights reserved.
8/14/2019 15_Deploying JavaEE Applications
8/4015-8 Copyright 2007, Oracle. All rights reserved.
Deployment Containers
A deployment module is a packaging structure for components that ultimately execute in a run-timecontainer.
EJB Web Application Container
8/14/2019 15_Deploying JavaEE Applications
9/4015-9 Copyright 2007, Oracle. All rights reserved.
Packaging Java EE ApplicationComponents
4. ejb.jarClass files for enterprise beans and an
EJB deployment descriptor
1. webtier.warJava servlets, JSP files, HTML, GIF files, and
a Web application deployment descriptor
2. JavaEEappClient.jarJava EE application client (Java class), andan application client deployment descriptor
3. Resource adapter ( .rar )Java interfaces, classes, native libraries
and other documentation, and the resource
adapter deployment descriptor
Java EE application.ear
8/14/2019 15_Deploying JavaEE Applications
10/4015-10 Copyright 2007, Oracle. All rights reserved.
JARs
Java Archives (JARs): Are simple Java archive files Are used to package application files together
(classes, images, and so on) Can be included in Web Archives (WARs) and
Enterprise Archives (EARs) Can be included in library paths
8/14/2019 15_Deploying JavaEE Applications
11/4015-11 Copyright 2007, Oracle. All rights reserved.
WARs
Web Archives (WARs): Are specialized archives for packaging
Java EEcompliant Web applications Have a fixed directory structure Have a deployment descriptor for the Web
application
lib
Contain servlet code and
JavaBeans not in standard JARfilesContains required classesthat are packaged in standardJAR files
classes
WEB-INF
web.xml
index.html
welcome.jsp
8/14/2019 15_Deploying JavaEE Applications
12/4015-12 Copyright 2007, Oracle. All rights reserved.
EJB JARs
EJB JARs: Are specialized JARs for packaging EJBs Have a fixed directory structure
Have a deployment descriptor for the EJBcomponents
EJB Classes
Contain the class filesfor the EJBs, usuallyin a package directorystructureRemote, Home, and
Bean classes
ejb-jar.xml
myEJB
META-INF
8/14/2019 15_Deploying JavaEE Applications
13/4015-13 Copyright 2007, Oracle. All rights reserved.
The EJB Deployment Process
JARcommand/
tool
EJBJAR
JNDI
Component deployersresponsibility
DevelopersresponsibilityHome interfaceRemote interface
Bean classOther classes
Deploymentdescriptor
Deploymenttools/
commands
Deployed EJB in theserver
8/14/2019 15_Deploying JavaEE Applications
14/4015-14 Copyright 2007, Oracle. All rights reserved.
EARs
EAR files: Are specialized archives for packaging Java EE-
compliant enterprise applications for deployment
Have a deployment descriptor May have Web modules May have EJB modules May have client modules
8/14/2019 15_Deploying JavaEE Applications
15/4015-15 Copyright 2007, Oracle. All rights reserved.
EAR File Structure for aJava EE Application: Example
META-INF < appname >
EJB classes META-INF
ejb-jar.xml
index.htmlJSPs
WEB-INFweb.xmlclasses
application-client.xml
Servlet classes
Client classes META-INF
application.xml
8/14/2019 15_Deploying JavaEE Applications
16/4015-16 Copyright 2007, Oracle. All rights reserved.
Working with Deployment Descriptors
Deployment descriptors are: Added to the application archive in the META-INF
directory relative to the archive root
Used to customize application-specificconfiguration and specify deployment information Merged with deployment plans, if provided
8/14/2019 15_Deploying JavaEE Applications
17/4015-17 Copyright 2007, Oracle. All rights reserved.
JSR-88 Deployment Plans
Deployment plans are: Used to create a client-side grouping of
application configuration data needed to deploy
the application to a Java EE container Implemented for support of the JSR-88specification, which defines creation of deployment plans
Created when you deploy the application Saved in files that can be retrieved, edited, and
reused
8/14/2019 15_Deploying JavaEE Applications
18/4015-18 Copyright 2007, Oracle. All rights reserved.
Creating a JSR-88 Deployment Plan
Deployment plans are created: By default (if none are supplied) When the application is deployed by:
JDeveloper in the ConfigureApplication window
ApplicationServer Control
8/14/2019 15_Deploying JavaEE Applications
19/4015-19 Copyright 2007, Oracle. All rights reserved.
Working with JSR-88 Deployment Plans
The deployment plan provides many properties thatenable the fine-tuning of application deployment to thetarget Java EE container. The deployment plan: Includes properties
defaultDataSource to select the data source usedby the application for management of data by EJBentities
prependDeploymentName to specify that the EAR
file is prepended with an underscore ( _ ) after deployment Can be saved for reuse Can be reloaded and edited when deploying an
application
8/14/2019 15_Deploying JavaEE Applications
20/4015-20 Copyright 2007, Oracle. All rights reserved.
Oracle Application Server Containersfor Java EE (OC4J)
OC4J is the Java EE server implementation inOracle Application Server 10 g .
Key features:
Implements Java EE 1.4 Specification Runs on standard JVM Provides high performance and scalability Is productive for developers to use Is simple to manage and deploy Provides clustering for high availability and failover
8/14/2019 15_Deploying JavaEE Applications
21/4015-21 Copyright 2007, Oracle. All rights reserved.
OC4J Architecture
Web
container
JNDI
JMS
EJB
container
AJP13
ORMI
JDBC
JTA
JavaMail
JAF
mod_oc4j
Client
EJB client
Oracle HTTPServer
ORMI
AJPHTTP
OC4J server process
JAAS
JCA
8/14/2019 15_Deploying JavaEE Applications
22/4015-22 Copyright 2007, Oracle. All rights reserved.
OC4J Server Configuration Files
OC4J server XML files
Web siteWeb site
Server configuration
jazn.xml
Web site
default-web-site.xml
Oracle HTTP Server configuration files
mod_oc4j.conf
jazn-data.xml
server.xml
data-sources.xml
rmi.xml
jms.xml
8/14/2019 15_Deploying JavaEE Applications
23/4015-23 Copyright 2007, Oracle. All rights reserved.
Relation of Configuration Files
webapp1.war
8/14/2019 15_Deploying JavaEE Applications
24/4015-24 Copyright 2007, Oracle. All rights reserved.
Application Logging
Application logging in Oracle Application Server 10 g is configured by specifying the location of alog file in the orion-application.xml file:
To create a log file formatted in XML, use OracleDiagnostic Logging (ODL):
8/14/2019 15_Deploying JavaEE Applications
25/4015-25 Copyright 2007, Oracle. All rights reserved.
Data Sources
Data sources provide logical database mappings: Developer uses the logical representation of a
database. Deployer maps to the physical data sources.
Java EE applications use published DataSource objects by: Looking up the published name via Java Naming
and Directory Interface (JNDI) Using JDBC
Connectionmethods to connect to
the database Data sources are published in the JNDI tree. They come in different varieties. They are referenced in orion-application.xml .
8/14/2019 15_Deploying JavaEE Applications
26/4015-26 Copyright 2007, Oracle. All rights reserved.
Data Source Definition
Global data sources are defined in theOC4J_HOME/config/data-sources.xml file. You specify each data source by using an XML tag. Attributes specify values for the data source.
Application-specific data sources: Use the tag in the orion-application.xml file.
OC4J_HOME/applications
myapp
application.xml
data-sources.xmlPoints to
8/14/2019 15_Deploying JavaEE Applications
27/40
8/14/2019 15_Deploying JavaEE Applications
28/40
8/14/2019 15_Deploying JavaEE Applications
29/40
15-29 Copyright 2007, Oracle. All rights reserved.
Example:Creating a Web Deployment Profile
12
43
8/14/2019 15_Deploying JavaEE Applications
30/40
15-30 Copyright 2007, Oracle. All rights reserved.
Deploying an Application: EJB Tier
1. Make sure that the ejb-jar.xml file containsunique mappings for each EJB in the application.
2. Create a JAR deployment profile ( .deploy ) inJDeveloper.
3. Right-click the .deploy file and select either of the following: Deploy to JAR file Deploy to OracleAS 10 g
8/14/2019 15_Deploying JavaEE Applications
31/40
15-31 Copyright 2007, Oracle. All rights reserved.
Example:Creating an EJB Deployment Profile
3 4
1
2
8/14/2019 15_Deploying JavaEE Applications
32/40
15-32 Copyright 2007, Oracle. All rights reserved.
Deploying an Application: EAR File
1. Create an EAR deployment profile in JDeveloper.2. Specify the EJB JAR and WAR files that are to be
included in this EAR file.
3. Right-click the .deploy file and select either of the following: Deploy to EAR file Deploy to OracleAS10 g
8/14/2019 15_Deploying JavaEE Applications
33/40
8/14/2019 15_Deploying JavaEE Applications
34/40
15-34 Copyright 2007, Oracle. All rights reserved.
Example:Creating the Application Deployment
Descriptor
1 2
3 4
8/14/2019 15_Deploying JavaEE Applications
35/40
15-35 Copyright 2007, Oracle. All rights reserved.
Java EE Application Deployment toOracle Application Server 10 g
Deploying to OC4J can be done in multiple ways:
Use JDeveloper.
Use a command-line tool (such asANT).
Step 1: Create WAR,EAR file
Use Oracle Enterprise Manager (installed with Oracle ApplicationServer 10 g ): Access the EnterpriseManager Web site http:// : (requires login).
Use JDeveloper: Specify anapplication server and click Deploy.
Step 2: Deploy
8/14/2019 15_Deploying JavaEE Applications
36/40
8/14/2019 15_Deploying JavaEE Applications
37/40
15-37 Copyright 2007, Oracle. All rights reserved.
Oracle Enterprise Manager
8/14/2019 15_Deploying JavaEE Applications
38/40
15-38 Copyright 2007, Oracle. All rights reserved.
Deploying with Application Server Control
8/14/2019 15_Deploying JavaEE Applications
39/40
15-39 Copyright 2007, Oracle. All rights reserved.
Summary
In this lesson, you should have learned how to: Describe the Java EE server environment and how
Java EE applications are deployed as modules
Create an Enterprise Archive, containing JAR,WAR, and deployment descriptor files Define the process for deploying all the
components of a Java EE application Describe OC4J as the container for your
application Use data sources to connect to the database
8/14/2019 15_Deploying JavaEE Applications
40/40
Practice Overview:Deploying Java EE Applications
This practice covers deploying the course application.