Bea WebLogic Server 8 For Dummies. Wiley

by Jeff Heaton

GetUp and Running With JSP, EJBs, Web Services, and More!

Part I: Installing and Configuring WebLogic

Part II: Understanding WebLogic Components 

Part III: Employing Web Services .

Part IV: The Forgotten Services

Part V: Big-Time, Heavy-Duty Server Configuration

Part VI: The Part of Tens


e-books shop
Bea WebLogic Server 8 For Dummies


About the Author
Jeff Heaton is the author of four books and more than two dozen articles, a
college instructor, and a consultant. He teaches introductory and advanced
Java at St. Louis Community College at Meramec. His specialty is in Internet,
socket-level/spidering, and artificial intelligence programming. Many examples
and tutorials can be found at his web site at http://www.jeffheaton.com.
Jeff is a Sun Certified Java Programmer, a member of the IEEE, and holds a
master’s degree in Information Management from Washington University in St. Louis.

Author’s Acknowledgments
There are many people who were helpful in the creation of this book.
I owe a great deal to Susan Pink for all her hard work editing this book and
making sure that my ideas stayed on track and were easy to follow. I would
also like to thank Allen Wyatt for helping construct the flow of many of the
chapters in this book and adding additional material. Will Iverson did a great
job as technical editor, making sure everything was just right and suggesting
additional material as needed.

Everyone at Wiley was easy to work with, and I appreciate your support.
I would like to thank Melody Layne for working out the initial details of this
book and making it a reality. Melody was also helpful in getting information
about version 8.1 of WebLogic.

Finally, I would like to thank everyone at the Studio B agency for helping with
this and other book projects of mine. In particular, thanks to Laura Lewin for
all your help and being my agent on this book.


Introduction
Welcome to BEA WebLogic Server 8 For Dummies. Whether you are an
administrator, a developer, a manager, or all of the above, you will find
something in this book to make your job easier.
WebLogic is the most widely used application server on the market today.
You can use WebLogic in large or small projects and to develop both traditional
client-server as well as web-based applications.

About This Book
This book gives you a broad understanding of BEA WebLogic Server.
The main audience consists of developers and administrators, but anyone
involved in a WebLogic project will benefit from reading this book. Managers
can gain an overview of the components that make up their system. Quality
assurance personnel can benefit from the same understanding.

For developers, this book shows quick examples to get you up and running
in many of the technologies supported by WebLogic. Rather than give you
extensive application examples, I focus on short, easy-to-follow examples
than can become the starting point for something more complex. For administrators,
I step you through many common WebLogic tasks and the configuration
settings you should use.

Finally, everyone should have an understanding of how the components of a
web application fit together and what WebLogic can do for your application.
This book gives you that viewpoint too.

Conventions Used in This Book
Throughout this book, several typefaces are used. Here’s a brief explanation:
When an important term is introduced, it appears in italics.
All URLs in the book appear in computer font. For example: www.bea.com
The code examples appear in computer font as well. For instance: int i=0;
And when a variable or command appears in the text, it’s in computer
font too. For example: “The JAVA_OPTIONS variable allows you to pass
additional parameters to the Java virtual machine.”
Directories appear in computer font. You’ll see something like this:
“You should switch to the weblogic\bin directory.”
Sometimes, you’ll see italic computer font, such as
c:\weblogic\bin> install -name yourWebLogicServer
This means you should type everything as written, except you should
replace yourWebLogicServer with — you guessed it — the name of your server.
When you should choose menu options, each option is separated by an
arrow, like this: Start➪All Programs➪Accessories➪Command Prompt.
Code listings contain complete Java source files or configuration files. A
code listing always has a title, such as “Listing 1-1: Count to Ten.”
Code snippets are small sections of source code that do not make up a
complete source file on their own.

What You Don’t Have to Read
For Dummies books are designed so that you can read any chapter you like, in
any order you want. This makes it easier to skip chapters that contain information
you’re already familiar with or simply don’t need. In addition, if you
Already have a WebLogic server up and running, you can skip Part I.
Are familiar with EJB development or aren’t planning to use EJBs, you can skip Part II.
Are not using web services, you can skip Part III.
Are developing a non-web application, you can skip Part IV.
Are just starting out with WebLogic, don’t concern yourself too much
with clustering, security, and performance tuning. These Part V topics
might be useful later, though.
Just want to get started with WebLogic, Part VI (which contains many
suggestions for using WebLogic) is not essential reading.

Foolish Assumptions
You should have at least a passing knowledge of the Java programming language,
but you don’t need to be an expert in Java. You should be familiar with
the following concepts:
Entering Java programs
Compiling and executing Java programs
Using classes, methods, and variables
You should also have a basic familiarity with the Internet, including the use of
web browsers and downloading software from web sites.
You should also have some knowledge of SQL to understand how WebLogic
accesses external data, which is stored in databases. It is not necessary for
you to be an SQL expert, but you should be familiar with basic SELECT,
INSERT, UPDATE, and DELETE statements.

How This Book Is Organized
BEA WebLogic Server 8 For Dummies has six parts. As you proceed through
the book, each part increases in complexity. Each chapter covers a specific
topic and provides code examples, explanations, and sample projects for you
to complete. As you complete each chapter, you will have completed one or
more projects that demonstrate the main ideas discussed in that chapter.
Part I: Installing and Configuring WebLogic
I begin by showing you how to install WebLogic. If you need no special
options, installing WebLogic can be as easy as installing any other Windows
application. If your installation has special needs, it can be a bit trickier. I
show you a standard installation and describe the details of a more complex
installation. After you find out how to install WebLogic, you discover how to
customize it to meet your needs.
Part II: Understanding WebLogic Components
Creating web applications is perhaps the most common use for WebLogic. In
Part II, you find out about some of the components that make up a web application.
One of the primary components is Enterprise JavaBeans (EJB). I show
you how to construct various types of EJBs and describe their differences.
Part III: Employing Web Services
Web services work much like any Java object that contains a set of reusable
methods. The main difference is that a web service allows other programs to
call these methods through the Internet. Web services are usually accessed
using the simple object access protocol (SOAP), which means different systems
can communicate. An object hosted on a Windows computer could be
accessed by a Macintosh, for example. In this part, you create a web service
using WebLogic. You also find out how to access your own web services and
those provided by third parties.
Part IV: The Forgotten Services
A number of services run behind the scenes, so they’re not noticed in a typical
web application. These services take care of binding the entire application
together and providing access to the underlying databases. For example,
Java Database Connectivity (JDBC) allows your web application to access
databases, Java Message Service (JMS) allows programs to exchange messages,
and Java Naming and Directory Interface (JNDI) allows named resources
to be located. In Part IV, you discover the ins and outs of all these “behind the
scenes” services.
Part V: Big-Time, Heavy-Duty Server Configuration
After you develop your application and test it, you’re ready for the big time.
Part V shows you some of the more advanced configuration options available
in WebLogic. For example, clustering allows you to use many different server
computers as one large virtual server. A virtual server can be much more reliable
and can process information faster than a single server. You also find out
about different security issues and how to resolve them.
Part VI: The Part of Tens
In Part VI, you find out about ten best practices that are a result of my experience
with WebLogic and web development in general. I also provide tips for
administrators and general tips to heed before going live.


Table of Contents
Introduction..........
About This Book .............
Conventions Used in This Book .....
What You Don’t Have to Read ....
Foolish Assumptions ..........
How This Book Is Organized ....
Part I: Installing and Configuring WebLogic .....
Part II: Understanding WebLogic Components .....
Part III: Employing Web Services .............
Part IV: The Forgotten Services .......
Part V: Big-Time, Heavy-Duty Server Configuration ....
Part VI: The Part of Tens ....................................
Icons Used in This Book ..........................
Where to Go from Here .................
Part I: Installing and Configuring WebLogic ...................7
Chapter 1: Introducing Application Servers . . . . . . . . . . . . . . . . . . . . . .9
Application Server Basics ..............................................................................9
Achieving reliability through redundancy .......................................10
Making applications scalable .............................................................11
Improving modularity .........................................................................11
J2EE, Java’s Approach to Application Servers ..........................................12
JavaServer Pages .................................................................................12
Enterprise JavaBeans ..........................................................................12
Java Transaction Service ....................................................................13
Java Message Service ..........................................................................13
Java Naming and Directory Interface ................................................13
Enterprise applications ......................................................................13
Major Features of WebLogic Server ............................................................14
Platform support .................................................................................14
Web applications .................................................................................14
EJB support ..........................................................................................14
Database connectivity ........................................................................15
Web services ........................................................................................15
Clustering .............................................................................................16
Security .................................................................................................16
Chapter 2: Installing WebLogic Server . . . . . . . . . . . . . . . . . . . . . . . . . .17
Installation Overview ....................................................................................17
System requirements ..........................................................................18
Getting WebLogic ................................................................................19
Understanding licensing .....................................................................20
Using the GUI Mode Installer .......................................................................21
Using Configuration Wizard .........................................................................24
Using the Console Mode Installer ...............................................................26
Installing under UNIX ..........................................................................27
Installing under Windows ...................................................................28
Using the Silent Mode Installer ....................................................................29
Creating a template file .......................................................................30
Invoking the silent mode installation program ...............................33
Chapter 3: Gentlemen, Start Your WebLogic Engines . . . . . . . . . . . . .35
Writing a WebLogic Startup Script ..............................................................35
The standard startup script ...............................................................36
Constructing your own startup script ..............................................37
Starting WebLogic from the Windows Start Menu ....................................39
Starting WebLogic Server Automatically ...................................................40
Configuring WebLogic as a Windows service ..................................40
Running WebLogic as a UNIX daemon ..............................................43
Chapter 4: Configuring and Administering WebLogic . . . . . . . . . . . . .45
Understanding Domains, Clusters, Servers, and Machines .....................46
Using Administration Console .....................................................................47
Logging on to Administration Console .............................................47
Using Administration Console ...........................................................48
Defining Network Channels ..........................................................................50
Introducing Node Manager ..........................................................................53
Setting Up Node Manager .............................................................................54
Setting up the Node Manager hosts file ............................................54
Configuring SSL for Node Manager ...................................................55
Configuring a control machine to use Node Manager ....................56
Configuring startup arguments for managed servers .....................58
Starting Node Manager .................................................................................60
Starting Node Manager using start scripts ......................................60
Starting Node Manager as a Windows service ................................61
Setting Node Manager environment variables ................................61
Monitoring the Server ..................................................................................64
Part II: Understanding WebLogic Components ..............67
Chapter 5: Creating Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . .69
Server Basics .................................................................................................69
Setting Up a Web Application ......................................................................70
Creating your server ...........................................................................71
Creating your web application ..........................................................71
Testing your web application ............................................................73
Programming your web application .................................................74
Packaging your web application .......................................................74
Deploying your web application .......................................................75
Directory Structure for Your Web Application ..........................................77
The Files in a Web Application ....................................................................78
Using JSP ...............................................................................................79
A quick look at servlets ......................................................................82
Using JSTL ............................................................................................83
Chapter 6: Using EJBs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .87
Creating Stateless Session Beans ................................................................88
Creating the remote interface ............................................................88
Creating the home interface ..............................................................89
Creating the bean class .......................................................................90
Creating deployment descriptors .....................................................91
Creating the client class .....................................................................93
Building the Stateless Session Bean EJB ....................................................94
Deploying the Stateless Session EJB ...........................................................97
Testing the Stateless Session EJB ...............................................................98
Adding State ...................................................................................................99
Accessing Data with Entity Beans .............................................................104
Configuring Message-Driven Beans ..........................................................105
Chapter 7: Using Entity Beans . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .107
Understanding WebLogic Database Access .............................................107
Creating the connection pool ..........................................................109
Creating the data source ..................................................................109
Constructing a BMP Bean ..........................................................................112
Constructing the bean interface ......................................................112
Constructing the home interface ....................................................112
Constructing the bean implementation ..........................................113
Constructing the bean configuration files ......................................118
Compiling a BMP Bean ...............................................................................120
Constructing a CMP Bean ..........................................................................123
Constructing the value objects ........................................................123
Constructing the local bean interfaces ...........................................125
Constructing the remote bean interface ........................................126
Constructing the local home interfaces .........................................126
Constructing the remote home interface .......................................127
Constructing the abstract bean implementation ..........................128
Constructing the bean configuration files ......................................131
Compiling a CMP Bean ...............................................................................137
Chapter 8: Stepping Up to Enterprise Applications . . . . . . . . . . . . . .139
Organizing Your Directories .......................................................................140
The structure of the WebLogic directory .......................................140
Examining the directory structure ..................................................142
Creating Deployment Descriptors ............................................................143
Understanding deployment descriptors ........................................144
Creating descriptors using tools .....................................................145
Creating descriptors manually ........................................................146
Packaging Your Enterprise Application ....................................................149
Deploying Your Enterprise Application ....................................................150
Part III: Employing Web Services ..............................153
Chapter 9: Building and Deploying Web Services . . . . . . . . . . . . . . .155
Defining a Web Service ...............................................................................156
Choosing and Building a Backend Component .......................................157
Building a Synchronous Web Service ......................................................158
Working with a Java class backend component ............................158
Working with a stateless session EJB backend component .........159
Building an Asynchronous Web Service ..................................................161
Packaging Your Web Service ......................................................................162
Packaging a synchronous service ...................................................162
Packaging an asynchronous service ...............................................168
Deploying Your Web Service ......................................................................168
Chapter 10: Accessing Web Services . . . . . . . . . . . . . . . . . . . . . . . . . .173
Using a Static Client ....................................................................................173
Understanding WSDL ........................................................................174
Generating the client stub ................................................................175
Building the client application .........................................................176
Running the client application .........................................................179
Using a Dynamic Client ...............................................................................180
Constructing the dynamic client .....................................................180
Running the dynamic client .............................................................182
Chapter 11: Using WebLogic Workshop . . . . . . . . . . . . . . . . . . . . . . . .183
Creating a Web Service ...............................................................................183
Creating a Workshop application and a web service ...................184
Adding methods to your web service .............................................185
Testing your web service .................................................................189
Debugging Web Services ............................................................................193
Packaging and Deploying Web Services ...................................................195
Directory locations ...........................................................................195
Packaging a web service ...................................................................196
Packaging for a different host ..........................................................197
Deploying web services ....................................................................198
Part IV: The Forgotten Services ..................................201
Chapter 12: Accessing Data with JDBC . . . . . . . . . . . . . . . . . . . . . . . .203
Creating a Connection Pool .......................................................................203
Defining a Data Source ................................................................................206
Using JDBC with EJBs .................................................................................208
Obtaining the connection .................................................................212
Closing the data source ....................................................................213
Executing an SQL statement ............................................................214
Using prepared statements ..............................................................214
Submitting a query ............................................................................215
Monitoring JDBC .........................................................................................216
Chapter 13: Finding EJBs with JNDI . . . . . . . . . . . . . . . . . . . . . . . . . . .219
Understanding JNDI ....................................................................................219
Understanding JNDI names ..............................................................220
JNDI as a universal naming service .................................................221
Implementing JNDI Using WebLogic .........................................................222
Making WebLogic resources available through JNDI ....................222
Enabling JNDI to access WebLogic objects ....................................225
Chapter 14: Using Transactions with JTA . . . . . . . . . . . . . . . . . . . . . .229
Understanding Transactions .....................................................................229
Two-phase commit ............................................................................230
When to use transactions .................................................................231
When not to use transactions ..........................................................232
Using Transactions .....................................................................................233
Importing packages ...........................................................................233
Using JNDI to return an object reference .......................................234
Starting the transaction ....................................................................234
Updating the database ......................................................................235
Completing the transaction .............................................................236
Chapter 15: Sending Messages Between Programs with JMS . . . .239
Creating a WebLogic Message Service .....................................................240
Creating a connection factory .........................................................241
Defining a backing store ...................................................................244
Defining destination keys .................................................................246
Defining templates ............................................................................248
Creating a JMS server .......................................................................250
Creating queues and topics .............................................................252
Accessing Your Message Service ..............................................................253
ConnectionFactory ............................................................................254
Connection .........................................................................................254
Session ................................................................................................255
Destination .........................................................................................255
MessageProducer and MessageConsumer ....................................255
Message ..............................................................................................255
Creating a Point-to-Point JMS Client .........................................................257
Creating the receiver .........................................................................258
Creating the sender ...........................................................................260
Creating a Publish-and-Subscribe JMS Client ..........................................263
Creating the subscriber ....................................................................263
Creating the publisher ......................................................................265
Part V: Big-Time, Heavy-Duty Server Configuration ....269
Chapter 16: Working with Server Clusters . . . . . . . . . . . . . . . . . . . . .271
Understanding Clustering ..........................................................................271
Performance through clustering .....................................................272
Reliability through clustering ..........................................................273
Components of WebLogic Clustering .......................................................273
Node Manager ....................................................................................274
Clustered domain ..............................................................................274
Clustered JDBC ..................................................................................274
Load balancing ...................................................................................275
Connection proxy ..............................................................................275
Configuring WebLogic Clustering ..............................................................275
Installing WebLogic Server ...............................................................276
Creating a clustered domain ............................................................276
Starting the WebLogic Server cluster .............................................283
Configuring Node Manager ..............................................................284
Configuring load balancing ..............................................................285
Configuring proxy plug-ins ...............................................................285
Configuring clustered JDBC .............................................................288
Chapter 17: Tuning WebLogic Server . . . . . . . . . . . . . . . . . . . . . . . . . .289
WebLogic Server Performance Packs .......................................................289
Thread Settings ...........................................................................................291
Setting thread count ..........................................................................291
Detecting stuck threads ....................................................................295
JDBC Performance Settings .......................................................................295
JDBC connection pools .....................................................................295
Caching prepared statements ..........................................................296
EJB Performance Settings ..........................................................................297
Setting EJB pool size .........................................................................297
Allocating pool size for session and message beans ....................297
Allocating pool size for anonymous entity beans .........................298
Tuning initial beans in the free pool ...............................................298
Setting EJB caching size ...................................................................298
Starting WebLogic Server with Performance Options ............................299
Setting Your Java Compiler ........................................................................299
Chapter 18: Implementing Security . . . . . . . . . . . . . . . . . . . . . . . . . . . .301
Understanding WebLogic Security ............................................................301
Secure Sockets Layer (SSL) ........................................................................301
Obtaining an identity ........................................................................303
Storing keys and certificates ............................................................304
Enabling SSL on your server ............................................................307
Introduction to Security Realms ...............................................................308
Users ...................................................................................................309
Groups ................................................................................................311
Security roles .....................................................................................314
Security policies ................................................................................316
Part VI: The Part of Tens ...........................................319
Chapter 19: Ten Best Practices for Developers . . . . . . . . . . . . . . . . .321
Keep Adequate Documentation ................................................................321
Use Usenet ...................................................................................................322
Don’t Over-Engineer ...................................................................................322
Set Up Development Environments ..........................................................323
Know What You’re Developing ..................................................................324
Understand the Tools .................................................................................324
Create Modular, Decoupled Systems ........................................................324
Be Mindful of Security ................................................................................325
Test Your Software ......................................................................................326
Manage Your Build Process ......................................................................326
Chapter 20: Ten Tips for Administrators . . . . . . . . . . . . . . . . . . . . . . . .327
Document Procedures ................................................................................327
Define a Service Level Agreement .............................................................328
Set Up On-Call Procedures .........................................................................328
Plan for Growth ...........................................................................................329
Monitor Your Servers .................................................................................329
Back Up Your Servers .................................................................................330
Keep Your Systems Secure .........................................................................330
Understand Log Files ..................................................................................330
Test with Clusters .......................................................................................331
Keep WebLogic Up-to-Date .........................................................................332
Chapter 21: Ten Tasks Before Going Live . . . . . . . . . . . . . . . . . . . . . . .333
Test Your System .........................................................................................333
Conduct a Stress Test .................................................................................334
Set Up a Parallel Environment ...................................................................335
Perform Fault Testing .................................................................................335
Set Up a Bug Tracking System ...................................................................335
Formulate a Disaster Recovery Plan ........................................................336
Choose Your Date ........................................................................................337
Keep the Lines of Communication Open ..................................................337
Be Ready for Anything ................................................................................337
Be Ready with Support ...............................................................................337
Index........................................................................339


Screenshot

e-books shop

Purchase Now !
Just with Paypal



Product details
 Price
 Pages
 385 p
 File Size
 7,708 KB
 File Type
 PDF format
 ISBN
 0-7645-2472-0
 Copyright
 2003 by Wiley Publishing, Inc 
  ●▬▬▬▬▬❂❂❂▬▬▬▬▬●
●▬▬❂❂▬▬●
●▬❂▬●

═════ ═════

Previous Post Next Post