Using EJBs

Enterprise JavaBeans (EJBs) are reusable server-side Java components that encapsulate the business logic of a distributed application. All EJBs are created and managed at runtime by an EJB container, which provides essential system-level services such as support for transactions, security, persistence, and concurrency. WebLogic mediates all client invocations to the enterprise bean through the EJB container.

In this chapter, you will learn about building, deploying, and optimizing EJBs within WebLogic. To do this, you also will see how the XML deployment descriptors help configure the various services provided by the EJB container. In fact, the XML descriptors provide vital information on assembly and deployment, and also determine how the container manages the EJB instances at runtime. The standard XML descriptor contains information on deployment, the abstract schema model, security restrictions, and transaction settings for the EJB component. The WebLogic-specific deployment descriptors allow you to configure the main topics covered by this chapter namely pooling, EJB concurrency, automatic EJB persistence, transaction, failover and clustering behavior, and life-cycle optimizations.

Any EJB implementation requires several Java classes and a number of XML descriptor files. Creating, synchronizing, and maintaining these configuration settings have traditionally been quite a burden on the developer. WebLogic provides several tools to remove this hardship. The primary tool is EJBGen, an EJB code generator. With this tool you need only maintain a single Java file all the other source files and XML descriptors then can be generated automatically. WebLogic also provides several convenience classes that reduce the amount of boiler-plate code that you need to write when developing EJBs. Finally, many of these tasks are integrated with WebLogic Workshop, making EJB development very simple indeed.

WebLogic provides some great services for optimizing EJBs. The most important of these is the pool and caching behavior, which attempts to ensure that a ready instance of an EJB always is available. WebLogic also is able to limit unnecessary loading of data into an entity bean by storing the state across transactions. Of course, you can safely do this only if you can determine the circumstances under which the data will change. You also can minimize the writing of data by configuring read-only and read-mostly EJB types. The distributed invalidation framework is particularly powerful in these circumstances, allowing either the periodic or user-driven refresh of data stored in the read-only EJBs. Finally, WebLogic provides load-balancing and failover facilities for EJBs. EJBs can be clustered, allowing home retrieval and method invocation to be distributed across all members of the cluster.

Introduction

Web Applications

Managing the Web Server

Using JNDI and RMI

JDBC

Transactions

J2EE Connectors

JMS

JavaMail

Using EJBs

Using CMP and EJB QL

Packaging and Deployment

Managing Domains

Clustering

Performance, Monitoring, and Tuning

SSL

Security

XML

Web Services

JMX

Logging and Internationalization

SNMP



WebLogic. The Definitive Guide
WebLogic: The Definitive Guide
ISBN: 059600432X
EAN: 2147483647
Year: 2003
Pages: 187

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net