Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Mastering BEA WebLogic Server
PREMIUM
Số trang
636
Kích thước
9.7 MB
Định dạng
PDF
Lượt xem
1853

Mastering BEA WebLogic Server

Nội dung xem thử

Mô tả chi tiết

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Back Cover

Written by leading experts in the field, this advanced-level book provides best practices for developing and

deploying WebLogic Server 8.1 applications. The authors share their real-world experience with WebLogic Server

and its features to help you understand not only how things can be done, but also how things should be done. They

walk you through different design solutions, architectures, construction techniques, deployment options, and

management techniques, explaining the benefits of each alternative. A realistic example application that leverages

key technologies such as JSP, Jakarta Struts, JMS, EFB, and Web Services is also built and deployed to help

illustrate selected techniques and best practices.

Each decision made during the development and deployment of the applications is discussed in detail, providing

insight and direction for similar decisions in your own efforts.

The best practices presented cover a wide range of topics, ranging from Web application and EJB development

recommendations to advanced administration, performance tuning, and configuration techniques. With these best

practices, you’ll quickly learn how to:

Choose an appropriate architecture for your WebLogic Server application

Package and deploy WebLogic Server applications properly

Leverage the latest EJB, JMS, Security, and Web services features available in WebLogic Server 8.1

Deliver and troubleshoot scalable high-performance systems

Configure and manage your development, test, and production environments for optimum productivity and

performance

About the Authors

Gregory Nyberg is a technical architect, focusing on the development of enterprise J2EE applications using BEA

WebLogic Server.

Robert Patrick is Senior Director of Technology at BEA Systems, specializing in designing and troubleshooting large￾scale systems built with BEA WebLogic Server.

Paul Bauerschmidt is a former software engineer in the WebLogic Server Security Team at BEA Systems.

Jeff McDaniel is Senior Director of the Technical Solutions Group at BEA Systems.

Raja Mukherjee is Director of Systems Engineering at BEA Systems.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Mastering BEA WebLogic Server-Best Practices for

Building and Deploying J2EE Applications

Gregory Nyberg

Robert Patrick

Paul Bauerschmidt

Jeffrey McDaniel

Raja Mukherjee

Vice President and Executive Publisher:

Bob Ipsen

Publisher:

Joe Wikert

Executive Editor:

Robert M. Elliott

Developmental Editor:

Brian McDonald and Emilie Herman

Editorial Manager:

Kathryn A. Malm

Senior Production Editor:

Angela Smith

Text Design & Composition:

Wiley Composition Services

This book is printed on acid-free paper.

Copyright © 2003 by Gregory Nyberg, Robert Patrick, Paul Bauerschmidt, Jeffrey McDaniel, and Raja

Mukherjee. All rights reserved.

Published by Wiley Publishing, Inc., Indianapolis, Indiana

Published simultaneously in Canada

No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by

any means, electronic, mechanical, photocopying, recording, scanning, or otherwise, except as permitted

under Section 107 or 108 of the 1976 United States Copyright Act, without either the prior written

permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the

Copyright Clearance Center, Inc., 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978)

646-8700. Requests to the Publisher for permission should be addressed to the Legal Department, Wiley

Publishing, Inc., 10475 Crosspoint Blvd., Indianapolis, IN 46256, (317) 572-3447, fax (317) 572-4447, E￾mail: [email protected].

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their best efforts in

preparing this book, they make no representations or warranties with respect to the accuracy or

completeness of the contents of this book and specifically disclaim any implied warranties of

merchantability or fitness for a particular purpose. No warranty may be created or extended by sales

representatives or written sales materials. The advice and strategies contained herein may not be suitable

for your situation. You should consult with a professional where appropriate. Neither the publisher nor

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

author shall be liable for any loss of profit or any other commercial damages, including but not limited to

special, incidental, consequential, or other damages.

For general information on our other products and services please contact our Customer Care

Department within the United States at (800) 762-2974, outside the United States at (317) 572-3993 or fax

(317) 572-4002.

Trademarks: Wiley, the Wiley Publishing logo and related trade dress are trademarks or registered

trademarks of Wiley Publishing, Inc., in the United States and other countries, and may not be used

without written permission. BEA WebLogic Server is a trademark of BEA Systems, Inc. J2EE is a

trademark of Sun Microsystems, Inc. All other trademarks are the property of their respective owners.

Wiley Publishing, Inc., is not associated with any product or vendor mentioned in this book.

Wiley also publishes its books in a variety of electronic formats. Some content that appears in print may

not be available in electronic books.

Library of Congress Cataloging-in-Publication Data:

ISBN: 0-471-28128-X

Printed in the United States of America

10 9 8 7 6 5 4 3 2 1

To Meredith -

For her patience, love, and support.

Greg

To Li Yan -

For her love, encouragement, and patience over the past five years.

Robert

Acknowledgments

The authors would like to thank the many people who helped create this book:

To our editor, Robert Elliott, thank you for your patience and support.

To our development editors, Emilie Herman and Brian MacDonald, thank you for helping us craft a

readable and well-organized book.

To the many people who helped review the technical content and provided critical assistance along

the way, our heartfelt thanks. Special recognition to key folks in BEA's Engineering organization who

provided invaluable insight and suggestions: Rob Woollen, Seth White, Cedric Beust, Smitty (a.k.a.

Michael Smith), Chris Fry, Greg Brail, Tom Barnes, Zach (a.k.a. Stephen Zachwieja), Mark Griffith,

Andrew Sliwkowski, Craig Blitz, Neil Smithline, Peter Bower, Tony Vlatas, Viresh Garg, and many

others. Thanks also to additional technical reviewers Mark Willis, Prasad Muppirala, Ben Johnson,

Kelly Nawrocke, and Tim Dawson. This book would not be what it is without the help of all these fine

people. Any errors or omissions should be attributed solely to the authors.

I would like to thank my wife, Meredith, for her support and encouragement over these many months. It's

finally done! I'd also like to thank my co-author, Robert, for his steadfast dedication to accuracy and

completeness; the book would be much less than it is without you. I'd also like to thank the guy who signs

my paychecks, Chris Spurgat, for his support and flexibility when the book dominated my life. Finally, I'm

very thankful for the grace and peace I've been given through a carpenter's son. All things are possible.

- Greg Nyberg

I would like to thank my wife for her incredible patience, support, and prodding throughout the entire

process. I would also like to thank my boss, Scott Dietzen, for giving me encouragement as well as the

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

time to finish the book. I'd like to give thanks to Paul Bauerschmidt, Jeff McDaniel, and Raja Mukherjee for

their contributions to the book and their patience in helping me review their material. Finally, I would like to

give special thanks to Greg Nyberg for his extreme patience with me through the writing process. Without

you, this book would have never gotten finished!

- Robert Patrick

About the Authors

Gregory Nyberg has over 16 years of experience in the design and development of object-oriented

systems and specializes in large mission-critical systems using BEA WebLogic Server. Mr. Nyberg is the

founder of and a frequent speaker at the Minneapolis BEA Users' Group, and he has spoken at the BEA

eWorld conference and other national conferences numerous times. Mr. Nyberg recently wrote the book

WebLogic Server 6.1 Workbook for Enterprise JavaBeans 3rd Edition (O'Reilly & Associates, 2002), a

companion workbook for Enterprise JavaBeans 3rd Edition by Richard Monson-Haefel (O'Reilly &

Associates, 2001). Mr. Nyberg has also written and delivered training classes in C++, Forte, Java, and

J2EE technologies, and he currently works as an architect and consultant for clients employing WebLogic

Server in mission-critical J2EE applications.

Robert Patrick is the Director of Technology, Office of the CTO, for BEA Systems, Inc. Mr. Patrick has

over 10 years' experience in the design and development of distributed systems, and he specializes in

designing and troubleshooting large, high- performance, mission-critical systems built with BEA WebLogic

Server and BEA TUXEDO. Mr. Patrick has worked for BEA Systems for the past 5 years and spends most

of his time advising Fortune 1000 companies how to best apply BEA technology to solve their business

problems. He has written several papers and is a frequent speaker at the BEA eWorld Conference.

Paul Bauerschmidt has six years' experience in the design and development of Java systems,

specializing in security frameworks. Prior to his current position at the Chicago Mercantile Exchange, Mr.

Bauerschmidt spent four years in the WebLogic Security team at BEA Systems, Inc., where he helped

plan, develop, and support all security features in WebLogic Server. Before that, Mr. Bauerschmidt worked

on the Java port of Intel's implementation of the Common Data Security Architecture (CDSA). Mr.

Bauerschmidt is also a frequent speaker at BEA eWorld and other security conferences.

Jeff McDaniel is currently the Senior Director of the Technical Solutions Group at BEA Systems, Inc. Mr.

McDaniel specializes in the design and validation of distributed architectures utilizing Enterprise

JavaBeans, CORBA, and BEA TUXEDO. While leading BEA's technical S.W.A.T. team, Mr. McDaniel

worked with many of BEA's Fortune 100 customers, consulting in areas such as performance

management and deployment best practices.

Raja Mukherjee has over 12 years of experience designing and deploying mission-critical systems for

Fortune 1000 companies. As a Director of the Technical Solutions Group for BEA Systems, Inc., Mr.

Mukherjee leads a team of architects specializing in troubleshooting, performance tuning, and

benchmarking J2EE applications using the BEA WebLogic Platform. Prior to joining BEA, Mr. Mukherjee

was Senior Technical Architect for a major consulting company, where he helped design high-availability

infrastructures for Fortune 500 clients. He has extensive experience tuning C/C++ and database

applications and has written many papers.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Introduction

Overview

The book you are holding is different from other books about WebLogic Server 8.1 and related

technologies.

First, it is an advanced book designed to complement the BEA online documentation and other

introductory books on J2EE and WebLogic Server technologies, providing intermediate- to advanced-level

developers, architects, and administrators with in-depth coverage of key J2EE development and

deployment topics. You won't find much introductory material in this book, and the book will not replicate

basic references or information available through other sources. This book starts where other books and

references stop.

Second, this is a book with an opinion. As the subtitle indicates, Mastering BEA WebLogic Server focuses

on best practices for building and deploying J2EE applications in WebLogic Server 8.1. The authors want

to share their real-world experience with the technology and help you understand not only how things can

be done, but also how things should be done. Different design solutions, architectures, construction

techniques, deployment options, and management techniques will be presented and explained-but we do

not stop there. We go on and explain the benefits of a given alternative and when to use it.

Finally, the primary example application built and described in these pages is a realistic, complex

application that highlights many of the features of J2EE technologies in general and WebLogic Server 8.1

in particular. The example application leverages key technologies such as JSP, Jakarta Struts, JMS, EJB,

and Web Services to demonstrate their use, and the text walks you through each decision made during the

development and deployment of the application to assist you in making similar decisions in your own

efforts.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Organization of the Book

Mastering BEA WebLogic Server is organized around three key themes:

Walking you through the design, construction, and deployment of a realistic example application

Discussing advanced topics and best practices in areas such as administration, performance tuning,

and configuration of WebLogic Server environments

Providing you with best practices for developing and deploying your own WebLogic Server

applications

The first 10 chapters focus on the first theme, and the next 4 target the second theme; best practices are a

focus throughout the entire book. Here is a brief description of each chapter to help you understand the

scope and organization of the book:

Chapter 1 reviews key Web application concepts and technologies and then discusses advanced topics

such as response caching, custom tags, and servlet filtering.

Chapter 2 examines the presentation-tier requirements that drive Web application architectures,

compares JSP-centric and servlet-centric architectures, and makes specific recommendations to help you

choose an appropriate architecture for your WebLogic Server application.

Chapter 3 details the design of the presentation-tier layer of a fairly large and complex J2EE application.

Topics include alternative page-assembly techniques, business-tier interfaces, and the requirements of the

example application that lead to the chosen design.

Chapter 4 walks through the construction of the Struts- and JSP-based example Web application.

Construction techniques unique to WebLogic Server are emphasized along with the components and

techniques resulting from the choice of presentation approach, Web application architecture, and

business-tier interaction techniques.

Chapter 5 discusses the steps required to package and deploy a WebLogic Server Web application with

an emphasis on WebLogic-specific techniques and best practices.

Chapter 6 examines options and best practices related to the implementation of Enterprise JavaBeans

(EJB) technology in WebLogic Server 8.1. After a brief review of EJB technology and the WebLogic Server

EJB container, the chapter presents WebLogic-specific features and capabilities and explains how best to

leverage them in your development efforts.

Chapter 7 walks through the design and construction of the business tier of the example application,

highlighting key concepts and best practices. Candidate business-tier architectures are identified and

examined in light of a representative set of business-tier requirements, construction options for EJB

components are compared, and selected business-tier components in the example application are

examined to highlight implementation details and best practices.

Chapter 8 discusses the steps required to package and deploy WebLogic Server EJB applications in a

development environment. The basic structures of EJB and enterprise applications are reviewed, Ant￾based build processes are presented, options for packaging applications are compared, and deployment

techniques for WebLogic Server development environments are examined.

Chapter 9 presents information and best practices related to the WebLogic Server JMS implementation.

Topics include JMS clustering, quotas, flow control, transactions, application design, asynchronous

consumers, and foreign providers.

Chapter 10 covers important topics related to WebLogic Server Security, including details on the

WebLogic Security Framework and available security providers. This chapter also presents techniques for

configuring secure clients and servers, setting up secure server-to-server communication, and managing

application security using WebLogic Security features.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Chapter 11 focuses on WebLogic Server administration and the architecture of the WebLogic Server

product. This is not a users' guide to the administration console, but rather an in-depth look at the internal

architecture of WebLogic Server, a discussion of important administrative concepts such as server health

states and network channels, and a thorough treatment of the configuration, monitoring, and management

of WebLogic Server and WebLogic Server-based applications.

Chapter 12 presents best practices for delivering and troubleshooting scalable high-performance

systems. It includes a discussion of core principles and strategies for scalable J2EE systems, a collection

of important design patterns and best practices that affect performance and scalability, and steps and

techniques you can use to improve performance and solve scalability issues in your systems.

Chapter 13 rounds out the discussion of development-related best practices with recommendations in key

areas related to the development environment. Topics include development-environment hardware and

software, organizing your project directory structure, establishing a build process, choosing appropriate

development tools, and creating a unit-testing infrastructure for your project.

Chapter 14 discusses strategies and best practices for deploying Weblogic Server applications in a

production environment, focusing on production deployment strategies, global traffic-management

solutions, and production-security best practices.

Chapter 15 reviews Web Services technology, describes WebLogic Server's Web Services support, and

presents best practices related to Web Services. Example Web Services are created using WebLogic

Server utilities, advanced Web Services features in WebLogic Server are discussed, and a Web Service is

built to interface with the primary example program in the book.

Chapters 1 through 10 cover key development-related topics such as Web application design and

development, EJB design and development, JMS, and security. Numerous best practices are presented in

these chapters as topics and options are presented and explained. You should probably read these

chapters in order as they also track the design and development of the example application and build on

each other to some extent.

Chapters 11 through 15 cover best practices related to administration, deployment, performance tuning,

environment configuration, and Web Services development. These chapters tend to be less dependent on

earlier chapters and can be read independently if the topics are of interest.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Who Should Read This Book

Mastering BEA WebLogic Server is targeted at J2EE application developers and architects with an

intermediate to advanced level of expertise. Although this book is targeted primarily at users of the BEA

WebLogic Server product, many of the best practices and advanced topics will also be of value to users of

other J2EE-compliant application servers.

Because this is an advanced book, beginning J2EE programmers should consider reading one or more

introductory texts on J2EE technologies and WebLogic Server before reading this book. Good references

include Mastering Enterprise JavaBeans, 2nd Edition, by Ed Roman, Scott Ambler, and Tyler Jewel (John

Wiley & Sons, 2001), Core Servlets and JavaServer Pages by Marty Hall (Prentice Hall PTR, 2000), and

BEA WebLogic Server Bible, Second Edition, by Joe Zuffoletto and Lou Miranda (John Wiley & Sons,

2003).

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Tools You Will Need

The examples and best practices in this book are based on BEA's WebLogic Server 8.1 application server,

available from the BEA dev2dev site at http://dev2dev.bea.com/subscriptions. Download and install this

product if you plan to build and deploy any of the example applications. The WebLogic Server 8.1

installation includes the Java 2 SDK, the Ant build tool, and all libraries and utilities used in this book.

In addition to WebLogic Server 8.1, you will need a decent Java-aware editor or integrated development

environment (IDE) to view the example code properly. See the IDE discussion in Chapter 13 for some help

in selecting a product if you do not already own one.

Finally, the main example program in this book assumes that you have a copy of the Oracle RDBMS

available. See the companion Web site for information on porting the example to a different database

product.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Online Resources

The companion Web site for this book, http://www.wiley.com/compbooks/mastering-weblogic, contains

additional WebLogic Server resources and links, book errata, and all example code described in this book.

The site also contains bonus material supplementing the discussion of Web application architectures in

Chapter 2 with a detailed walkthrough of a complete example application built in both JSP-centric and

servlet-centric architectures.

The authors also maintain an online discussion group for comments, questions, and bug reports related to

this book and its example programs. The group is located at http://groups.yahoo.com/groups/mastering￾weblogic.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Chapter 1: Building Web Applications in WebLogic

Web applications are an important part of the Java 2 Enterprise Edition (J2EE) platform because the Web

components are responsible for key client-facing presentation and business logic. A poorly designed Web

application will ruin the best business-tier components and services. In this chapter, we will review key

Web application concepts and technologies and their use in WebLogic Server, and we will provide a

number of recommendations and best practices related to Web application design and construction in

WebLogic Server.

This chapter also provides the foundation for the discussion of recommended Web application

architectures in Chapter 2 and the construction and deployment of a complex, realistic Web application in

Chapters 3, 4, and 5.

Java Servlets and JSP Key Concepts

In this section we will review some key concepts related to Java Servlets and JavaServer Pages. If you are

unfamiliar with these technologies, or if you need additional background material, you should read one of

the many fine books available on the subject. Suggestions include Java Servlet Programming Bible by

Suresh Rajagopalan et. al. (John Wiley & Sons, 2002), Java Servlet Programming by Jason Hunter

(O'Reilly & Associates, 2001), and Core Servlets and JavaServer Pages by Marty Hall (Prentice Hall PTR,

2000).

Characteristics of Servlets

Java servlets are fundamental J2EE platform components that provide a request/response interface for

both Web requests and other requests such as XML messages or file transfer functions. In this section, we

will review the characteristics of Java servlets as background for a comparison of servlets with JavaServer

Pages (JSP) technology and the presentation of best practices later in the chapter.

Servlets Use the Request/Response Model

Java servlets are a request/response mechanism: a programming construct designed to respond to a

particular request with a dynamic response generated by the servlet's specific Java implementation.

Servlets may be used for many types of request/response scenarios, but they are most often employed in

the creation of HyperText Transfer Protocol (HTTP) responses in a Web application. In this role, servlets

replace other HTTP request/response mechanisms such as Common Gateway Interface (CGI) scripts.

The simple request/response model becomes a little more complex once you add chaining and filtering

capabilities to the servlet specification. Servlets may now participate in the overall request/response

scenario in additional ways, either by preprocessing the request and passing it on to another servlet to

create the response or by postprocessing the response before returning it to the client. Later in this

chapter, we'll discuss servlet filtering as a mechanism for adding auditing, logging, and debugging logic to

your Web application.

Servlets Are Pure Java Classes

Simply stated, a Java servlet is a pure Java class that implements the javax.servlet .Servlet

interface. The application server creates an instance of the servlet class and uses it to handle incoming

requests. The Servlet interface defines the set of methods that should be implemented to allow the

application server to manage the servlet life cycle (discussed later in this chapter) and pass requests to the

servlet instance for processing. Servlets intended for use as HTTP request/response mechanisms

normally extend the javax.servlet.http.HttpServlet class, although they may implement and

use the Servlet interface methods if desired. The HttpServlet class implements the Servlet

interface and implements the init(), destroy(), and service() methods in a default manner. For

example, the service() method in HttpServlet interrogates the incoming HttpServletRequest

object and forwards the request to a series of individual methods defined in the HttpServlet class

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

based on the type of request. These methods include the following:

doGet() for handling GET, conditional GET, and HEAD requests

doPost() for POST requests

doPut() for PUT requests

doDelete() for DELETE requests

doOptions() for OPTIONS requests

doTrace() for TRACE requests

The doGet(), doPost(), doPut(), and doDelete() methods in HttpServlet return a

BAD_REQUEST (400) error as their default response. Servlets that extend HttpServlet typically override

and implement one or more of these methods to generate the desired response. The doOptions() and

doTrace() methods are typically not overridden in the servlet. Their implementations in the

HttpServlet class are designed to generate the proper response, and they are usually sufficient.

A minimal HTTP servlet capable of responding to a GET request requires nothing more than extending the

HttpServlet class and implementing the doGet() method.

WebLogic Server provides a number of useful sample servlets showing the basic approach for creating

HTTP servlets. These sample servlets are located in the

samples/server/examples/src/examples/servlets subdirectory beneath the Web-Logic Server

home directory, a directory we refer to as $WL_HOME throughout the rest of the book. We will examine

some additional example servlets in detail during the course of this chapter. These example servlets are

available on the companion Web site for this book at http://www.wiley.com/compbooks/masteringweblogic.

Creating the HTML output within the servlet's service() or doXXX() method is very tedious. This

deficiency was addressed in the J2EE specification by introducing a scripting technology, JavaServer

Pages (JSP), discussed later in this chapter.

Servlets Have a Life Cycle

A servlet is an instance of the servlet class and has a life cycle similar to that of any other Java object.

When the servlet is first required to process a request, the application server loads the servlet class,

creates an instance of the class, initializes the instance, calls the servlet's init() method, and calls the

service() method to process the request. In normal servlet operation, this same instance of the servlet

class will be used for all subsequent requests.

Servlets may be preloaded during WebLogic Server startup by including the <load-on-startup>

element in the web.xml file for the Web application. You can also provide initialization parameters in this

file using <init-param> elements. WebLogic Server will preload and call init() on the servlet during

startup, passing the specified initialization parameters to the init() method in the ServletConfig

object.

An existing servlet instance is destroyed when the application server shuts down or intends to reload the

servlet class and create a new instance. The server calls the destroy() method on the servlet prior to

removing the servlet instance and unloading the class. This allows the servlet to clean up any resources it

may have opened during initialization or operation.

Servlets Allow Multiple Parallel Requests

Servlets are normally configured to allow multiple requests to be processed simultaneously by a single

servlet instance. In other words, the servlet's methods must be thread-safe. You must take care to avoid

using class- or instance-level variables unless access is made thread-safe through synchronization logic.

Typically, all variables and objects required to process the request are created within the service() or

doXXX() method itself, making them local to the specific thread and request being processed.

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Best

Practice

Servlets that allow multiple parallel requests must be thread-safe. Do not share class￾or instance-level variables unless synchronization logic provides thread safety.

Servlets may be configured to disallow multiple parallel requests by defining the servlet class as

implementing the SingleThreadModel interface:

...

public class TrivialSingleThreadServlet

extends HttpServlet implements SingleThreadModel

{

public void init(ServletConfig config) throws ServletException

{

super.init(config);

System.out.println("Here!");

}

...

This simple change informs the application server that it may not process multiple requests through the

same servlet instance simultaneously. The application server can honor this restriction in multiple ways: It

may block and queue up requests for processing through a single instance, or it may create multiple

servlet instances as needed to fulfill parallel requests. The servlet specification does not dictate how

application servers should avoid parallel processing in the same instance.

WebLogic Server satisfies the single-threaded requirement by creating a small pool of servlet instances

(the default pool size is five) that are used to process multiple requests. In older versions of WebLogic

Server, multiple parallel requests in excess of the pool size would block waiting for the first available

servlet instance. This behavior changed in WebLogic Server 7.0. The server now creates, initializes, and

discards a new instance of the servlet for each request rather than blocking an execute thread under these

conditions. Set the pool size properly to avoid this extra servlet creation and initialization overhead.

You can configure the size of the pool at the Web application level using the single-threaded￾servlet-pool-size element in the weblogic.xml deployment descriptor. If you choose to employ

single-threaded servlets in high-volume applications, consider increasing the pool size to a level

comparable to the number of execute threads in the server to eliminate the potential overhead required to

create extra servlet instances on the fly to process requests.

Although instance variables are safe to use in single-threaded servlets, class-level static variables are

shared between these instances, so access to this type of static data must be thread-safe even when

using the SingleThreadModel technique. Deploying and executing this

TrivialSingleThreadServlet example verifies this pooling behavior in WebLogic Server. The first

servlet request causes WebLogic Server to create five instances of the servlet, as evidenced by five

separate invocations of the init() method and the subsequent writing of five 'Here!' messages in the

log.

Best

Practice

In general, you should avoid using single-threaded servlets. If you find that you need to use

servlets that implement the SingleThreadModel, use the single-threaded-servlet￾pool-size element to set the pool size properly to avoid the overhead of creating and

initializing extra servlet instances to handle peaks in the number of concurrent requests to

the servlet.

Servlets May Access Request Data

The HttpServletRequest parameter passed in to the service() or doXXX() method contains a

wealth of information available to the servlet during the processing of the request. Useful data in the

HttpServletRequest is summarized in Table 1.1.

Table 1.1: Information Available in the HttpServletRequest

Mastering BEA WebLogic Server: Best Practices for

Building and Deploying J2EE Applications

by Gregory Nyberg, Robert Patrick et

al.

ISBN:047128128x

John Wiley & Sons © 2003 (743 pages)

This text provides best practices for developing and deploying

WebLogic Server 8.1 applications, and covers Web

application, EJB development recommendations, advanced

administration, performance tuning, and configuration

techniques.

Companion Web Site

Table of Contents

Mastering BEA WebLogic Server—Best Practices for Building and Deploying J2EE

Applications

Introduction

Chapter 1 - Building Web Applications in WebLogic

Chapter 2 - Choosing a Web Application Architecture

Chapter 3 - Designing an Example J2EE Application

Chapter 4 - Building an Example Web Application

Chapter 5 - Packaging and Deploying WebLogic Web Applications

Chapter 6 - Building Enterprise JavaBeans in WebLogic Server

Chapter 7 - Building an Example EJB Application

Chapter 8 - Packaging and Deploying WebLogic EJB Applications

Chapter 9 - Using WebLogic JMS

Chapter 10 - Using WebLogic Security

Chapter 11 - Administering and Deploying Applications in WebLogic Server

Chapter 12 - Optimizing WebLogic Server Performance

Chapter 13 - Development Environment Best Practices

Chapter 14 - Production Environment Best Practices

Chapter 15 - Developing and Deploying Web Services

Index

List of Figures

List of Tables

List of Listings

Type of Information Access Methods

Parameters passed in the

query string or through form

input fields

getParameterNames(), getParameter(),

getParameterValues(), getQueryString()

Server information getServerName(), getServerPort()

Client characteristics getRemoteAddr(), getRemoteHost(),

getAuthType(), getRemoteUser()

Request information getContentType(), getContentLength(),

getProtocol(), getScheme(), getRequestURI()

HTTP headers getHeaderNames(), getHeader(), getIntHeader(),

getDateHeader()

Cookies sent by browser getCookies()

Session information getSession(), getRequestedSessionId(),

isRequestedSessionIdValid(), ...

This is not an exhaustive list of the methods available on the HttpServletRequest class or its

superclass, ServletRequest. Refer to the servlet javadocs at

http://java.sun.com/products/servlet/2.3/javadoc/index.htmlor a good reference book on servlets for a

complete list including parameter types, return types, and other details.

A useful servlet packaged with the WebLogic Server examples, SnoopServlet, illustrates the use of

many of the methods available on the HttpServletRequest object. For example, this section of

SnoopServlet illustrates how to retrieve and display the names and values of all parameters passed to

the servlet:

...

Enumeration e = req.getParameterNames();

if (e.hasMoreElements()) {

out.println('<h1>Servlet parameters (Single Value style):</h1>');

out.println('<pre>');

while (e.hasMoreElements()) {

String name = (String)e.nextElement();

out.println(' ' + name + ' = ' + req.getParameter(name));

}

out.println('</pre>');

}

...

This servlet can be very useful for debugging HTML forms during development. Specify SnoopServlet

as the action for an HTML form to view all of the parameters, cookies, and headers sent by the browser

during submission of the form. Nothing is more frustrating than spending time debugging a servlet only to

find that the HTML form had an improperly named input item.

Best Practice Use the SnoopServlet as an action target during development and debugging to

inspect request information and verify HTML forms.

Note that SnoopFilter, a servlet filter discussed later in this chapter, provides a superior mechanism for

viewing request information for some or all pages in the Web application.

Servlets Use Session Tracking

A servlet is a request/response mechanism that treats each incoming request as an independent

processing event with no relationship to past or future requests. In other words, the processing is stateless.

Tải ngay đi em, còn do dự, trời tối mất!