WebLogic Server 11g for ADF/Forms Developers
Mark Prichard Java Platform Group, Oracle Fusion Middleware
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should
not be relied upon in making purchasing decisions.
The development, release, and timing of any features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.
Oracle WebLogic Suite Strategic Runtime Across Oracle Product Lines
Proven to Outperform
Best for Oracle Portfolio
Lowest Cost of Operations
Coherence
JRockit Real Time
WebLogic Server Java EE: Reliability, Availability, Scalability & Performance
High Performance, Reliable, Scale Out for Java, C++ and .NET
High Performance JVM with Extreme Low Latency
WebLogic Suite
Ente
rpris
e M
anag
er
Adm
in a
nd O
pera
tions
Developm
ent Tools
JDeveloper/Eclipse
Java EE/ISV Apps
SOA Suite
WebCenter Suite
Content Management
Suite
Identity Management
Suite
Business Intelligence
Suite
Integrated WebLogic Server
• http://localhost:7101/console/ • Log on with weblogic/weblogic1 • C:\Documents and Settings\<user>\Application Data\JDeveloper\...
\DefaultDomain\bin • (debug) -agentlib:jdwp=transport=dt_socket,server=y,address=1446
Domains and Servers
• What is a domain? – a logically related group of WebLogic Server instances that you
manage from a single set of configuration artifacts.
• What’s in a domain? – Servers – Clusters of servers
• What is a WebLogic Server instance? – A configured instance to host applications and resources
• WebApps, Enterprise Apps, Web Services, … • JMS, JDBC, Diagnostics, …
• What types of servers are there? – Administration Server – Managed Server
Creating/Copying a WebLogic Domain
• Configuration wizard: include at least Oracle JRF • Many ways to copy a domain: domain template
builder, pack/unpack, WebLogic Scripting Tool …
The Administration Server
• What is it? – Central configuration controller for the
entire domain • What else does it do?
– Hosts the Administration Console – Enables you to start and stop servers
from a central location – Enables you to migrate servers and
services within the domain – Enables you to deploy applications
within the domain • Guidelines:
– There must be exactly one* Administration Server in domain
– An Administration Server controls only one domain.
– For production use, we recommend not hosting application logic or resources on the Administration Server
Managed Servers
• What is it? – A running instance that hosts applications and
resources needed by those applications - The real work horses in a WebLogic domain
– Each Managed Server is independent of all other Managed Servers in the domain (unless they are in a cluster, defined later)
– You can have as many Managed Servers in a domain as you need
– Individual Managed Servers are typically added for capacity and application isolation
Managed Server Startup
• The Administration Server stores the master copy of the domain configuration, including the configuration for all managed servers in the domain
• Each Managed Server stores a local copy of its configuration.
• When a Managed Server starts, it connects to the Administration Server to synchronize the configuration
• When configuration is changed, the Administration Server sends changed configuration to Managed Servers
• How do I start a Managed Server? – With an Admin Server – In “Independence Mode”
Clusters and Machines
• A cluster is a group of Managed Servers running simultaneously and working together to provide increased scalability and reliability
• A cluster appears as a single instance to most clients. • Clusters enable some advanced features, such as Whole
Server Migration, Service Migration, and clustered JMS destinations.
• A machine definition is used to associate a computer with the Managed Servers it hosts.
• Used by Node Manager in restarting a failed Managed Server
• Used by a clustered Managed Server in selecting the best location for storing replicated session data
Load Balancing in a Cluster
• For JSPs and Servlets: load balancing is external – Web server proxy plug-in (round robin) – HTTP Proxy servlet (i.e., using WLS as a load balancer) – 3rd party hw or sw load balancer
• EJBs and RMI Objects: load balancing is done at connection – Objects are cluster-aware – Load balancing algorithm is stored in the clustered object’s stub – Objects are available on all cluster members; remote objects
connect/use according the LB algorithm in the stub – Load balancing algorithms: Round robin, weighted, random, server
affinity
Failover in a Cluster
• Servlets and JSPs: – HTTP session state is replicated to a secondary server
in the cluster or to a database • EJBs and RMI Objects:
– Replicas available throughout the cluster – Exceptions caught and retried on another instance – For Stateful Session Beans, state is replicated on a
secondary server
WebLogic Node Manager
• Utility/process running on a physical server that enables you to start, stop, suspend, and restart WebLogic Server instances remotely
• Must run on each physical server that hosts WebLogic Server instances that you want to control with Node Manager
• Not associated with a domain. Can start any server instance that resides on the same physical server.
• Optional, but required to start/stop servers using the Administration Console
• Required for Whole Server Migration and for some configurations of Automatic Service Migration
• Demo: How do I configure Node Manager?
WebLogic Scripting Tool (WLST)
• Scripting tool for administering a domain (create, configure, manage, monitor, deploy applications)
• Based on Jython – pure Java implementation of Python
• Great for automating repetitive tasks • Heavily used by customers and within BEA
• Example: How does JDev shut down the Integrated WebLogic Server instance?
WLST: Connection Modes
• Offline: analogous to the Configuration Wizard – Uses the Offline Configuration Framework
• Also used by the Configuration Wizard • Consistent results when using either tool
– read and write access to the configuration data that is persisted in the domain’s config directory or in a domain template JAR
– Intended to create a domain or modify a non-running domain
– Used during WLS install to create samples domains
• Online: analogous to the Administration Console – JMX client – Interacts with a server’s MBeans – Intended as a runtime management tool:
WSLT with OEPE 11.1.1.6
WLST – with SSL + Custom Trust java -Dweblogic.security.TrustKeyStore=CustomTrust -
Dweblogic.security.CustomTrustKeyStoreFileName=/home/oracle/security/labTrustKeystore.jks -Dweblogic.security.CustomTrustKeystoreType=JKS -Dweblogic.security.CustomTrustKeyStorePassPhrase=labpassword weblogic.WLST
wls:/offline> nmConnect('oracle','oracle1','node1.localdomain',5556,'labDomain','/home/oracle/wls1032/user_projects/domains/labDomain','ssl')
wls:/nm/labDomain> storeUserConfig('nm_user.config','nm_user.key',nm='true')
wls:/offline> nmConnect(userConfigFile=‘<path>/nm_user.config',userKeyFile=‘<path>/nm_user.key',host='node1.localdomain',port=5556,domainName='labDomain',domainDir=‘<path>/labDomain',mType='ssl')
Java Keystores for Dev/Test [oracle@node1 security]$ java utils.CertGen -certfile labcert1 -keyfile
labkey1 -keyfilepass labkeypass -cn "node1.localdomain" -o "MyOrganization" -ou "FOR TESTING ONLY" -keyusage digitalSignature,nonRepudiation,keyEncipherment,dataEncipherment,keyAgreement
[oracle@node1 security]$ cp /home/oracle/wls1032/wlserver_10.3/server/lib/CertGenCA.der .
[oracle@node1 security]$ java utils.der2pem CertGenCA.der
[oracle@node1 security]$ cat labcert1.pem CertGenCA.pem > cert1.pem
[oracle@node1 security]$ mv cert1.pem labcert1.pem
[oracle@node1 security]$ keytool -printcert -file labcert1.pem
[oracle@node1 security]$ java utils.ImportPrivateKey -keystore labIdentityKeystore.jks -storepass labpassword -alias labalias1 -keypass labaliaspass -certfile labcert1.pem -keyfile labkey1.pem -keyfilepass labkeypass
[oracle@node1 security]$ java utils.ImportPrivateKey -keystore labIdentityKeystore.jks -storepass labpassword -alias labalias1 -keypass labaliaspass -certfile labcert1.pem -keyfile labkey1.pem -keyfilepass labkeypass
Trust this certificate? [no]: yes
Shared Libraries and Class Loaders
• Shared Libraries used extensively by Oracle Applications – JRF, ADF, APPLCORE, etc – Applications explicitly declare a dependency on shared libraries
• Understanding Shared Libraries is critical to avoiding Class Loader related issues
Application shared libraries
my-web-1.war
my-ejb-1.jar
my-web-3.war
App-1.ear
my-web-2.war
my-ejb-2.jar
App-2.ear
my-web-1.war
my-ejb-1.jar
App-1.ear
my-web-3.war
my-web-2.war
my-ejb-2.jar
App-2.ear
my-web-3.war
App-lib.ear
Deployment view
Runtime view
Webapp shared libraries
WEB-INF/web.xml WEB-INF/lib/x.jar
foo.jsp bar.jsp
webapp-1.war
WEB-INF/web.xml WEB-INF/lib/y.jar
a.jsp b.html
webapp-lib.war
WEB-INF/web.xml* WEB-INF/lib/x.jar WEB-INF/lib/y.jar
foo.jsp bar.jsp a.jsp b.html
webapp-1.war
Dep
loym
ent v
iew
Run
time
view
Jar libraries
my-web-1.war
my-ejb-1.jar library.jar
App-1.ear
my-web-2.war
• Jar files and Jar libraries can be referenced from applications (EAR, WAR, JAR) via MANIFEST classpath or descriptors.
Preview – Classloader Analysis Tool
• Used internally for several releases • Will be shipped and supported with PS3 • Provided as web-app (wls-cat.war) • On-demand deployment (dev mode only) • URLs allow customization • Functionality:
– View classloader hierarchies and entire classpath for each classloader
– Analyze classpath conflicts (filtering classloader hints)
– Search for a class/resource on a classloader – View class definitions, interfaces
Preview – Classloader Analysis Tool
Retrieve Expose Process Capture
WebLogic Diagnostic Framework
Log File Event Collector
MBean Property Harvester
Code Instrumentor
Archiver
Watcher
JRockit Flight Recorder
Buffer
Accessor
Notifier
JRockit Mission Control
• WLST API • JMX API • WLDF Dashboard
• SNMP Trap • JMS Message • JMX Notification • SMTP Email • Diagnostic Image
Pull
Push
Instrumentation Extension
WLDF Instrumentation Configuration (Instrumented at Build Time) WS WebApp JDBC EJB Etc… JTA
WLDF Monitors and Action Groups
WLDF Instrumentation Engine
Extension Actions
Extension Data
WLDF Flight Recorder Actions
JRockit Flight Recorder
WLDF Flight Recorder Image Source
JRFR Producer API JRFR Consumer API
Diagnostic Image File With Flight Recorder Data
WLST, Console, WLDF Watch/Notification
WLST Image Manager
Extension supplied JRockit Supplied WLDF File/Artifact Available if JRockit is Used
Diagnostic Image File Without Flight Recorder Data
WLDF/JFR Integration Architecture
WLDF User-defined Pointcuts
<wldf-instrumentation-monitor>
<name>Trace_Servlet_Around_Service</name>
<action>TraceElapsedTimeAction</action>
<location-type>around</location-type>
<pointcut>
execution(* +javax.servlet.Servlet service(+javax.servlet.ServletRequest, +javax.servlet.ServletResponse))
OR execution(* +javax.servlet.http.HttpServlet doPost(+javax.servlet.ServletRequest, +javax.servlet.ServletResponse))
OR execution(* +javax.servlet.http.HttpServlet doGet(+javax.servlet.ServletRequest, +javax.servlet.ServletResponse))
</pointcut>
</wldf-instrumentation-monitor>
WLS 10.3.3, JFR R28 and JRMC 4.0.1 “Quick Start Guide”
• Turn on JFR default recording – -XX:FlightRecorderOptions=defaultrecording=true – Flight recorder command line documentation
• Configure WLS to use Platform MBean Server – Admin console: domain->configuration->general
tab (Advanced) – Check Platform MBean Server Enabled (default in
10.3.3) – Check Platform MBean Server Used (off by
default) – NB: Platform MBean Server security – -
Djavax.management.builder.initial=weblogic.mana
Working with JRockit Flight Recorder
• Start JRMC, connect to WLS • Configure WLS Diagnostic Volume (admin
console: server->configuration->general, “High”) • Right mouse, select “Dump Default Recording”
JRMC + Flight Recorder
WebLogic Server MBeans via Platform MBean Server + JRMC
Preview – WebLogic Maven Plugin
• WebLogic Maven Plugin – PS3: supports weblogic.Deployer functionality
• weblogic:deploy • weblogic:undeploy • weblogic:redeploy • weblogic:update-app • weblogic:start-app • weblogic:stop-app • weblogic:list-apps
– Same parameters as weblogic.Deployer – Other WLS Maven functionality planned for post-PS3
• Build plugin jar file with wljarbuilder.jar java -jar wljarbuilder.jar -profile weblogic-maven-plugin
• Install to local Maven repository mvn install:install-file -Dfile=<path>/weblogic-maven-plugin.jar -DgroupId=com.oracle.weblogic -DartifactId=weblogic-maven-plugin -Dpackaging=maven-plugin -Dversion=10.3.4 -DgeneratePom=true
• Add to Maven settings.xml <pluginGroups> <pluginGroup>com.oracle.weblogic</pluginGroup> </pluginGroups>
• Maven co-ordinates <groupid>com.oracle.weblogic</groupid> <artifactid>weblogic-maven-plugin</artifactid> <version>10.3.4</version>
Preview – WebLogic Maven Plugin
Maven example pom.xml (excerpt) <plugin> <groupId>com.oracle.weblogic</groupId> <artifactId>weblogic-maven-plugin</artifactId> <version>10.3.4</version> <configuration>
<adminurl>${wls.adminurl}</adminurl> <user>${wls.user}</user> <password>${wls.password}</password> <upload>false</upload> <action>deploy</action> <remote>false</remote> <verbose>true</verbose> <source>${project.build.directory}/${project.build.finalName}.
${project.packaging}</source> <name>${project.build.finalName}</name> </configuration>
</plugin>
Using Eclipse/OEPE with m2eclipse
• Third-party m2eclipse plugin provides Maven support for OEPE/Eclipse
• POM editor, dependency graphs, repo browser, mvn tasks
Example: Eclipse/OEPE with the m2eclipse plugin
37