Upload
rrisaac
View
215
Download
0
Embed Size (px)
Citation preview
8/2/2019 deploymentplanexample-090904080844-phpapp02
1/18
8/2/2019 deploymentplanexample-090904080844-phpapp02
2/18
2
Oracle WebLogic Server
JDBC Resource Ref
Deployment Plan Mapping
8/2/2019 deploymentplanexample-090904080844-phpapp02
3/18
3
Java EE Resource References
Java EE provides an abstraction mechanism toexternalize resource dependencies
JDBC, JMS, etc.
Do the Logical: Developer declares a resource-ref entry in application
descriptor file
Uses resource-ref entry in code
Do the Physical
Using vendor deployment descriptor, map the resource-refto a JNDI-NAME of resource on server
8/2/2019 deploymentplanexample-090904080844-phpapp02
4/18
4
Java EE Resource References
web.xml
A logical reference to a DataSource
jdbc/LogicalDS
javax.sql.DataSource
Container
weblogic.xml
jdbc/LogicalDS
MAP_THIS_DS
8/2/2019 deploymentplanexample-090904080844-phpapp02
5/18
5
Java EE Resource References
Web application Looks up logical DataSource from Java EE ENC
Or is injected as a named resource
No direct reference to physical database location
DataSource logicalds = null;String DS_NAME = "java:comp/env/jdbc/LogicalDS";
Connection c = null;
try {
Context ic = new InitialContext();
logicalds = (DataSource)ic.lookup(DS_NAME);
...} catch(Exception e) {
...
}
8/2/2019 deploymentplanexample-090904080844-phpapp02
6/18
6
Hey Thats Still Tightly Coupled
If weblogic.xml contains JNDI-NAMEreference then EAR file needs to be edited tochange the value
Defeats the purpose a little weblogic.xml
jdbc/LogicalDSDS_NEEDS_MAPPING
8/2/2019 deploymentplanexample-090904080844-phpapp02
7/187
The Deployment Plan
Deployment plan fully externalizes thesettings for an application
Override/change settings for the application
Separate to the application 1 1, 1 M relationship to an application
Domain specific or agnostic
Fed into the deployment process Command line option, specified in console
Changed deployment plan is read on updateoperation
8/2/2019 deploymentplanexample-090904080844-phpapp02
8/188
WLS Deployment Plan Tooling
Tooling provided to generate a default
deployment plan
Usage: java weblogic.PlanGenerator [options] [Path to application]
where options include:
-plan Name of plan to create. If not specified a default
will be used.
-dependencies (default) create plan that exports all dependency
properties
-declarations create plan that exports all declaration properties
-configurables create plan that exports all configurable propertiesexcept for dependencies and declarations
-all create plan that exports all changeable properties
8/2/2019 deploymentplanexample-090904080844-phpapp02
9/189
WLS Deployment Plan Tooling
Example:
$java weblogic.PlanGenerator -dependencies
-plan raw-plan.xml jdbc-resource-ref.ear
Generating plan for application jdbc-resource-ref.ear
Export option is: dependencies
Exporting properties...
Saving plan to raw-plan.xml...
8/2/2019 deploymentplanexample-090904080844-phpapp02
10/1810
WLS Deployment Plan Tooling
Resulting deployment plan: Variable created for declared resource-ref entry
jdbc-resource-ref.ear
ResourceDescription_jdbc/LogicalDS_JNDIName_12295809854680
8/2/2019 deploymentplanexample-090904080844-phpapp02
11/1811
WLS Deployment Plan Tooling
Resulting deployment plan: Mapping generated for resource-ref element
jdbc-resource-ref-web.war
weblogic-web-app
ResourceDescription_jdbc/LogicalDS_JNDIName_12295809854680
/weblogic-web-app/resource-description/[res-ref-name="jdbc/LogicalDS"]/jndi-name
8/2/2019 deploymentplanexample-090904080844-phpapp02
12/1812
Using a Deployment Plan
Modify variable values to reflect physicalresources of target server
Update value with JNDI name
Modify module-descriptor to specify requiredbehavior with variable value
add, remove, replace
8/2/2019 deploymentplanexample-090904080844-phpapp02
13/1813
jdbc-resource-ref.ear
ResourceDescription_jdbc/LogicalDS_JNDIName_12295809854680 jdbc/XEDS
jdbc-resource-ref-web.war
weblogic-web-app
ResourceDescription_jdbc/LogicalDS_JNDIName_12295809854680
/weblogic-web-app/resource-description/[res-ref-name="jdbc/LogicalDS"]/jndi-name
replace
Example Deployment Plan
8/2/2019 deploymentplanexample-090904080844-phpapp02
14/1814
Deployment Process
Deployment without deployment plan Setting in weblogic.xml is used
$java weblogic.Deployer -username weblogic -password weblogic -url t3://localhost:7001 -deploy -name jdbc-resource-ref jdbc-
resource-ref.ear
8/2/2019 deploymentplanexample-090904080844-phpapp02
15/1815
Deployment Process
Deployment with deployment plan Setting in deployment plan is used
$java weblogic.Deployer -username weblogic -password weblogic -url t3://localhost:7001 -deploy -name jdbc-resource-ref plan
raw-plan.xml jdbc-resource-ref.ear
8/2/2019 deploymentplanexample-090904080844-phpapp02
16/1816
Same App, Multi WLS Instances
PAUL
GEORGEYOKO
MILLS
JOHNjdbc/Primaryjdbc/Failover
jdbc/Primaryjdbc/Failover
jdbc/Primaryjdbc/Failover
RINGOjdbc/Primaryjdbc/Failover
jdbc/LogicalDS
jdbc/Primary
jdbc/LogicalDS
jdbc/Failover
EARjdbc/LogicalDS
Primary DP
Failover DP
Primary DB
Failover DB
8/2/2019 deploymentplanexample-090904080844-phpapp02
17/1817
Summary
Allow externalization of resource declarations
Use variable substitution, append operations
Supplied during deployment process for alldeployment tools/utilities (ant,weblogic.Deployer, console)
Powerful capability!
8/2/2019 deploymentplanexample-090904080844-phpapp02
18/18