ORACLE: Oracle Press Oracle WebLogic Server 11g Administration Handbook Sam R. Alapati Mc Graw Hill New York Chicago San Francisco Lisbon London Madrid Mexico City Milan New Delhi San Juan Seoul Singapore Sydney Toronto
ISP Foreword Acknowledgments Introduction xix xxi xxiii 1 Installing WebLogic Server and Using the Management Tools 1 Oracle WebLogic Server: An Overview 2 Oracle WebLogic Server Product Set 2 Terminology 3 Important WebLogic Server Concepts 9 Execute Threads and Queues 9 Implementing the JMX API and MBeans 10 Development and Production Mode 11 Listen Ports and Listen Threads 11 Choosing a JVM 12 Using Web Server Plug-Ins 12 Management APIs 13 Installing Oracle WebLogic Server 11g 14 Development-Only Installation 14 Installation Prerequisites 15 Installation Modes 15 Installation Procedures 15 Checking the Installed Features 18 Reinstalling WebLogic Server 20 Exploring the Installation Directories 20 The WebLogic Server Sample Applications 22 Starting the Examples Server. 23 Stopping the Server 24 ix
X Oracle WebLogic Server 11g Administration Handbook Upgrading Oracle WebLogic Server 25 Upgrade Tools 25 Upgrade Procedures 25 Performing a Rolling Upgrade 26 Using the Administration Console 28 Logging into the Administration Console 29 Navigating the Administration Console 31 Using the Change Center 33 Working with the Administration Console 36 Node Manager 37 The WebLogic Scripting Tool (WLST) 39 Offline and Online WLST 39 Invoking WLST 39 Using WLST in Script Mode 40 Connecting to a WebLogic Server Instance 41 Disconnecting from the Server 42 Using the Help Command 43 Key WLST Command Groups 43 Summary 45 2 Administering WebLogic Server Instances 47 Managing the Servers 48 Administration and Managed Servers 48 Admin Server Failures and the Managed Servers 49 Selecting the Start Mode for a Server 49 Configuring Class Caching 51 Setting the Environment 51 Configuring Server Instances with the Console 52 Providing User Credentials 54 Using the Node Manager to Manage Servers 57 Node Manager Capabilities 57 Starting the Node Manager 59 Stopping the Node Manager 60 Monitoring the Node Manager Logs 61 Running the Node Manager as a Windows Service 61 Configuring the Node Manager 63 The Node Manager Domains File 65 Key WLST Node Manager Commands 65 Life Cycle of WebLogic Server Instances 67 The STARTING, STANDBY, and RUNNING States 67 The SHUTDOWN, SUSPENDING, and FAILED States 69 Self Health Monitoring 70 How the Server Deals with the FAILED State 70 Shutdown Command Options 70
Contents XI Starting and Stopping WebLogic Server 72 Server Messages 72 Server Logs 72 Using a Startup Script to Start and Stop Servers 73 Using the java weblogic.server Command 75 Configuring Server Attributes with weblogic.server 78 Using the Ant Tool to Manage Servers 79 Managing Servers from the Administration Console 81 Using WLST Without the Node Manager 87 Using WLST with the Node Manager 89 Setting Up a WebLogic Server Instance as a Windows Service 92 Setting Up the Service 93 Setting Up the Managed Server as a Windows Service 94 Starting and Stopping the Service 94 Changing Startup Credentials for a Service 94 Removing a Service 95 Dealing with WebLogic Server Failures 95 Starting a Failed Admin Server 95 Managed Server Independence (MSI) Mode 97 Deleting Servers 98 Summary 99 3 Creating and Configuring WebLogic Server Domains 101 Structure of a WebLogic Server Domain 102 WebLogic Server Instances 103 WebLogic Server Clusters 104 Domain Resources 104 Domain Restrictions 105 Domain Directories 105 Understanding Domain Configuration Changes 108 The Domain Configuration File: config.xml 109 Modifying Domain Configuration 110 Using the Lock & Edit Mechanism in the Administration Console 115 Tracking Changes with Configuration Auditing 116 Making a Domain Read-Only 117 Controlling the Logging of Configuration Changes 118 Creating Domain Templates 119 Templates Offered by WebLogic Server 119 Creating a Custom Domain Template 120 Creating a Custom Extension Template 122 Creating Templates with the pack and unpack Commands 123 Creating a WebLogic Server Domain 125 Using the weblogic.server Command 125 Using the Configuration Wizard to Create a Domain 126 Extending Domains 130
xii Oracle WebLogic Server 11g Administration Handbook Creating a Domain with WLST Commands 131 Selecting the Startup Mode for the WebLogic Domain 135 Advanced Domain Configuration Options 136 Configuring the Admin Server 136 Configuring Managed Servers 137 Configuring Clusters 137 Assigning Managed Servers to Clusters 137 Creating HTTP Proxy Applications 138 Configuring Machines 138 Targeting Deployments to Clusters or Servers 139 Configuring a Persistent Store 139 Configuring Server Environments 142 Configuring the Network 142 Configuring WebLogic Server as a Web Server 144 Setting a Default Web Application 147 Preventing POST Denial of Service Attacks 148 ConfiguringHTTP Logging 148 Proxying Requests to Other Web Servers 150 Configuring the WebLogic Server Proxy Plug-Ins 151 Configuring Virtual Hosts 153 Protecting Domain Data 155 Backing Up a Domain's config.xml File 156 Backing Up the Security Data 156 Summary 157 4 Configuring Naming, Connections, Transactions, and Messaging 159 JNDI and Naming and Directory Services 160 JNDI Architecture 161 Viewing the WebLogic Server JNDI Tree 162 Using JNDI to Connect a Java Client to a Server 162 Clustered JNDI 165 Configuring Transactions 166 Transactions and the ACID Test 166 Types of WebLogic Transactions 166 Transactions and the Two-Phase Commit 166 Configuring WebLogic JTA 167 Monitoring Transaction Services 169 Transaction Logs and Transaction Recovery 170 Configuring Database Connections 171 JDBC Architecture 172 Enabling XA in the Database 175 Data Sources 175 Understanding WebLogic JDBC Configuration 176 Using a JDBC System Module 177 Creating a Generic Data Source 179 Using a CridLink Data Source 181
Contents xiii Configuring a Multi Data Source 182 Configuring a JDBC Data Source 184 Managing Data Sources 189 Starting and Stopping a Data Source 190 Configuring Java Messaging Services (JMS) 191 Message Communication Modes 191 Structure of a JMS Message 191 Components of a JMS Messaging Application 192 WebLogic JMS Architecture 195 Configuring WebLogic Server JMS 199 Monitoring JMS Servers 206 Creating JMS System Modules 208 System Modules and Subdeployments 213 Migration of JMS-Related Services 215 Store-and-Forward (SAF) Service for Reliable Messaging 216 WebLogic Messaging Bridge 218 Foreign JMS Servers 219 Configuring WebLogic JavaMail 219 Configuring Mail Sessions 220 Configuring a Mail Session 221 Summary 222 5 Configuring the WebLogic Server Environment 223 Optimizing Application Performance 224 WebLogic Server Thread Pools 224 Work Managers 225 Configuring Work Managers 226 Work Manager Components 228 Defining a Work Manager Through the Console 231 Managing Server Work Overload 234 Throttling the Thread Pool 234 Handling Overload or Failure Conditions 235 Limiting Active HTTP Sessions 236 Dealing with Stuck Threads 237 WebLogic Server Self Health Monitoring 238 Optimal Network Configuration 239 Benefits of Using Network Channels 239 Creating Custom Network Channels 240 Tunneling 241 Configuring Network Channels 242 Designing Network Channels 244 The Java Connector Architecture (JCA) 246 Managing Resource Adapters Through the Console 247 Monitoring Resource Adapter Connections 248 The WebLogic Tuxedo Connector 248 Summary 249
xiv Oracle WebLogic Server 11g Administration Handbook 6 Monitoring and Troubleshooting WebLogic Server 251 The Weblogic Diagnostic Framework 252 Using WLDF with the JRockit Flight Recorder 254 Using the Monitoring Dashboard 258 Configuring Diagnostic Image Capture 259 Configuring a Diagnostic Archive 262 Using a Diagnostic System Module 263 Configuring Metric Collection 265 Configuring WLDF Instrumentation 267 Configuring Watches and Notifications 274 Accessing the WLDF Diagnostic Data 279 Monitoring WebLogic Server Instances 280 Monitoring with the Administration Console 280 Monitoring with JMX 283 Using WLST Monitoring Scripts 286 Monitoring with SNMP 289 Understanding WebLogic Logging Services 293 Understanding the Log Files 293 Anatomy of a Log Message 294 Viewing Logs 295 Configuring a Domain Log Filter 296 Subsystem Logs 297 Understanding Server Log File Maintenance 297 Setting Debugging Flags Using the Console 298 Integrating Application and Server Logging 299 Controlling Server Log Messages to Log Destinations 299 WebLogic Server Troubleshooting 300 Summary Understanding Java Thread Dumps 300 Collecting a JRockit Thread Dump 303 JVM Crashes 306 Generating Logs for Troubleshooting 307 Automatically Logging Low Memory Conditions 308 Out of Memory Errors 309 7 Working with WebLogic Server Clusters 311 Introduction to WebLogic Server Clusters 312 Relationship Between Clusters and a Domain 313 Deployment in a Cluster 314 Cluster Architectures 314 How Clusters Communicate 318 Naming Cluster Instances 318 Configuring a Cluster 320 Using the Administration Console 320 310
Contents XV Managing a WebLogic Server Cluster 325 Starting and Stopping the Cluster 326 Starting and Stopping with Scripts 326 Monitoring a Cluster 329 Clustering WebLogic Server Services 330 JNDI Naming Service 330 JDBC Clustering 331 JMS and Clusters 331 WebLogic Server Load Balancing 331 Load-Balancing Servlets and JSPs 331 Load Balancing for EJBs and RMI Objects 332 Application Failover and Replication 334 Detecting Application Failures 335 Handling Servlet and JSP Failures 335 Failover for EJBs and RMIs 338 Handling Server and Service Failures 339 Migratable Servers 339 Summary Manual and Automatic Service Migration 339 Migratable Targets 339 Leasing and Automatic Migration 340 Migrating JMS-Related Services 341 Configuring Migration of JTA Services 343 Whole Server Migration 344 Using WLST to Migrate Services 347 8 Understanding WebLogic Server Application Deployment 349 Introduction to WebLogic Server Deployment 350 Types of Applications You Can Deploy 351 Deployment Targets 351 Deployment Tools 352 Deployment Descriptors, Annotations, and Deployment Plans 352 Configuring Deployments with Deployment Plans 355 Preparing Applications for Deployment 359 Deploying an Archive File 360 Exploded Archive Directory Deployment 361 Naming the Deployment and the Applications 362 Storing the Deployment Files 362 How WebLogic Server Accesses Source Files 363 Deploying Applications 365 Deployment Order 365 Using the Administration Console for Deployment 366 Using WLST to Deploy Applications 374 Deploying with weblogic.deployer 375 Deploying with the wldeploy Ant Task 380 348
XVi Oracle WebLogic Server 11g Administration Handbook Reducing Deployment Time During Development 381 Using the Autodeployment Feature During Development 381 Using FastSwap to Shorten the Development Cycle 382 Monitoring and Updating Applications 383 Monitoring Applications 383 Using Administration Mode to Sanity Test Deployments 384 Production Redeployment Strategies 387 Performing a Production Redeployment 388 Summary 391 9 Managing WebLogic Server Security 393 Java EE Security and OPSS 394 Java EE Security and WebLogic Server 395 The Java Security Manager 395 Oracle Platform Security Services 395 WebLogic Server Security Basics 397 WebLogic Server Resources 397 Security Realm 398 Security Providers 398 Managing Security Realms 400 Creating and Configuring a New Security Realm 400 Configuring the Security Providers 403 Configuring the Auditing Provider 404 Configuring Entitlements Caching 413 Users, Croups, Roles, and Security Policies 414 Users 415 Groups 416 Security Roles 418 Configuring Security Policies 420 Static and Dynamic Security Conditions 421 Security Models for Web Applications and EJBs 422 The Deployment Descriptor Only Model 422 The Custom Roles Model 422 The Custom Roles and Policies Model 423 The Advanced Model 423 Security-Related Deployment Descriptors 423 Configuring the Embedded LDAP Server 425 Configuring a RDBMS as the Security Store 427 Setting Up the RDBMS Security Store 427 Creating Tables in the RDBMS Store 427 Setting Up JMS Notifications for Security Changes 427 Configuring Domain Security 428 Configuring Domain Security in the Administration Console 429 Enabling Trust Between Domains 433 Using Connection Filters 434
Contents xvii Configuring SSL 434 Configuring Identity and Trust 435 Setting SSL Configuration Attributes 441 Oracle WebLogic Security Best Practices 446 Use Multiple Administrative Users 446 Control Access to WebLogic Resources 446 Avoid Running the Server Under a Privileged Account 446 Enable Security Auditing 447 Use Connection Filters 447 Prevent Denial of Service Attacks 447 Implement Security for Applications 447 Summary 449 10 WebLogic Server Performance Tuning 451 Tuning WebLogic Server 452 Thread Management 452 Tuning the Network I/O 453 Tuning the JVM 455 Understanding Memory Management 455 Understanding Locking 464 Tuning Messaging Applications 464 Tuning the Persistent Store 464 Tuning WebLogic JMS 466 Tuning WebLogic JMS Store-and-Forward 469 Tuning the Applications and Managing Sessions 469 Tuning Web Applications 469 Using Oracle Coherence 471 Tuning EJB Performance 473 SQL Tuning Best Practices 475 Managing Sessions 476 JPA and TopLink 476 Tuning Data Sources and Transactions 478 Tuning Data Sources 478 Tuning Transactions 480 Summary 480 Index 481