You are previewing JBoss® 4.0 The Official Guide.
O'Reilly logo
JBoss® 4.0 The Official Guide

Book Description

If you need to understand how JBoss works, why not learn it from the people who created it? JBoss 4.0 — The Official Guide is the authoritative resource recognized as the official print documentation for JBoss 4.0. The only book for advanced JBoss users, this guide presents a complete understanding to configuring and using JBoss 4.0. It is fully up-to-date with the new features and changes in JBoss 4.0, including those used to integrate development with Eclipse, incorporate Aspect-Oriented Programming and implement J2EE 1.4 functionality months ahead of the commercial competition. Get under the hood and explore everything that JBoss 4.0 can offer you with JBoss 4.0 — The Official Guide.

Table of Contents

  1. Copyright
  2. About the Authors
  3. We Want to Hear from You!
  4. Introduction
    1. What This Book Covers
    2. About JBoss
    3. About Open Source
    4. About Professional Open Source
    5. What’s New in JBoss 4.0
      1. J2EE Certification and Standards Compliance
      2. Server Configuration and Services
      3. JBoss AOP Support
      4. Hibernate Integration
      5. Clustering and Caching
  5. 1. Installing and Building the JBoss Server
    1. Getting the Binary Files
      1. Prerequisites
    2. Installing the Binary Package
      1. Directory Structure
      2. The Default Server Configuration File Set
      3. conf/jboss-minimal.xml
      4. conf/jboss-service.xml
      5. conf/jboss.web
      6. conf/jndi.properties
      7. conf/log4j.xml
      8. conf/login-config.xml
      9. conf/server.policy
      10. conf/standardjaws.xml
      11. conf/standardjboss.xml
      12. conf/standardjbosscmp-jdbc.xml
      13. conf/xmdesc/*-mbean.xml
      14. deploy/bsh-deployer.xml
      15. deploy/cache-invalidation-service.xml
      16. deploy/client-deployer-service.xml
      17. deploy/ear-deployer.xml
      18. deploy/ejb-deployer.xml
      19. deploy/hsqldb-ds.xml
      20. deploy/http-invoker.sar
      21. deploy/jboss-aop.deployer
      22. deploy/jboss-hibernate.deployer
      23. deploy/jboss-local-jdbc.rar
      24. deploy/jboss-ws4ee.sar
      25. deploy/jboss-xa-jdbc.rar
      26. deploy/jbossjca-service.sar
      27. deploy/jbossweb-tomcat50.sar
      28. deploy/jms/hsqldb-jdbc2-service.xml
      29. deploy/jms/jbossmq-destinations-service.xml
      30. deploy/jms/jbossmq-httpil.sar
      31. deploy/jms/jbossmq-service.xml
      32. deploy/jms/jms-ds.xml
      33. deploy/jms/jms-ra.rar
      34. deploy/jms/jvm-il-service.xml
      35. deploy/jms/uil2-service.xml
      36. deploy/jmx-console.war
      37. deploy/jmx-invoker-service.sar
      38. deploy/mail-ra.rar
      39. deploy/mail-service.xml
      40. deploy/management/console-mgr.sar and web-console.war
      41. deploy/monitoring-service.xml
      42. deploy/properties-service.xml
      43. deploy/scheduler-service.xml and schedule-manager-service.xml
      44. deploy/sqlexception-service.xml
      45. deploy/uuid-key-generator.sar
    3. Basic Installation Testing
    4. Booting from a Network Server
    5. Building the Server from Source Code
      1. Accessing the JBoss CVS Repositories at SourceForge
      2. Understanding CVS
      3. Anonymous CVS Access
      4. Obtaining a CVS Client
      5. Building the JBoss Distribution Using the Source Code
      6. Building the JBoss Distribution Using the CVS Source Code
      7. An Overview of the JBoss CVS Source Tree
      8. Using the JBossTest Unit Testsuite
  6. 2. The JBoss JMX Microkernel
    1. JMX
      1. An Introduction to JMX
        1. The JMX Instrumentation Level
        2. The JMX Agent Level
        3. The JMX Distributed Services Level
        4. JMX Component Overview
          1. MBeans
          2. The Notification Model
          3. MBean Metadata Classes
          4. The MBean Server
          5. Agent Services
    2. The JBoss JMX Implementation Architecture
      1. The JBoss ClassLoader Architecture
      2. Class Loading and Types in Java
        1. ClassCastException: I’m Not Your Type
        2. IllegalAccessException: Doing What You Should Not
        3. LinkageErrors: Making Sure You Are Who You Say You Are
          1. Debugging Class-Loading Issues
        4. Inside the JBoss Class-Loading Architecture
          1. Viewing Classes in the Loader Repository
          2. Scoping Classes
          3. The Complete Class-Loading Model
      3. JBoss XMBeans
        1. Descriptors
        2. The Management Class
        3. The Constructors
        4. The Attributes
        5. The Operations
        6. Notifications
    3. Connecting to the JMX Server
      1. Inspecting the Server: The JMX Console Web Application
        1. Securing the JMX Console
      2. Connecting to JMX Using RMI
      3. Command-Line Access to JMX
        1. Connecting Twiddle to a Remote Server
        2. Sample Twiddle Command Usage
      4. Connecting to JMX Using Any Protocol
    4. Using JMX as a Microkernel
      1. The Startup Process
      2. JBoss MBean Services
        1. The SARDeployer MBean
        2. The Service Life Cycle Interface
        3. The ServiceController MBean
          1. The create(ObjectName) Method
          2. The start(ObjectName) Method
          3. The stop(ObjectName) Method
          4. The destroy(ObjectName) Method
        4. Specifying Service Dependencies
        5. Identifying Unsatisfied Dependencies
        6. Hot Deployment of Components, the URLDeploymentScanner
      3. Writing JBoss MBean Services
        1. A Standard MBean Example
        2. XMBean Examples
          1. Version 1: The Annotated JNDIMap XMBean
          2. Version 2: Adding Persistence to the JNDIMap XMBean
          3. Version 3: Adding Security and Remote Access to the JNDIMap XMBean
      4. Deployment Ordering and Dependencies
    5. The JBoss Deployer Architecture
      1. Deployers and Class Loaders
    6. Exposing MBean Events via SNMP
      1. The Event to Trap Service
    7. Remote Access to Services, Detached Invokers
      1. A Detached Invoker Example: The MBeanServer Invoker Adaptor Service
      2. JRMPInvoker: RMI/JRMP Transport
      3. PooledInvoker: RMI/Socket Transport
      4. IIOPInvoker: RMI/IIOP Transport
      5. JRMPProxyFactory: Building Dynamic JRMP Proxies
      6. HttpInvoker: RMI/HTTP Transport
      7. JRMPInvoker: Clustered RMI/JRMP Transport
      8. HttpInvoker: Clustered RMI/HTTP Transport
      9. HttpProxyFactory: Building Dynamic HTTP Proxies
      10. Steps to Expose Any RMI Interface via HTTP
  7. 3. Naming on JBoss
    1. An Overview of JNDI
      1. The JNDI API
        1. Names in JNDI
          1. Contexts
          2. Obtaining a Context by Using InitialContext
      2. J2EE and JNDI: The Application Component Environment
        1. ENC Usage Conventions
          1. Environment Entries
          2. EJB References
          3. EJB References with jboss.xml and jboss-web.xml
          4. EJB Local References
          5. Resource Manager Connection Factory References
          6. Resource Manager Connection Factory References with jboss.xml and jboss-web.xml
          7. Resource Environment References
          8. Resource Environment References with jboss.xml and jboss-web.xml
    2. The JBossNS Architecture
      1. The Naming InitialContext Factories
        1. Naming Discovery in Clustered Environments
        2. The HTTP InitialContext Factory Implementation
        3. The Login InitialContext Factory Implementation
      2. Accessing JNDI over HTTP
      3. Accessing JNDI over HTTPS
      4. Securing Access to JNDI over HTTP
      5. Securing Access to JNDI with a Read-only Unsecured Context
      6. Additional Naming MBeans
        1. The org.jboss.naming.ExternalContext MBean
        2. The org.jboss.naming.NamingAlias MBean
        3. The org.jboss.naming.JNDIView MBean
  8. 4. Transactions on JBoss
    1. Transaction and JTA Overview
      1. Pessimistic and Optimistic Locking
      2. The Components of a Distributed Transaction
      3. The Two-phase XA Protocol
      4. Heuristic Exceptions
      5. Transaction Identities and Branches
    2. JBoss Transaction Internals
      1. Adapting a Transaction Manager to JBoss
      2. The Default Transaction Manager
      3. UserTransaction Support
  9. 5. EJBs on JBoss
    1. The EJB Client-Side View
      1. Specifying the EJB Proxy Configuration
    2. The EJB Server-Side View
      1. Detached Invokers: The Transport Middlemen
      2. The HA JRMPInvoker: Clustered RMI/JRMP Transport
      3. The HA HttpInvoker: Clustered RMI/HTTP Transport
    3. The EJB Container
      1. The EJBDeployer MBean
        1. Verifying EJB Deployments
        2. Deploying EJBs into Containers
        3. Initializing with Configuration Information
          1. The container-name Element
          2. The call-logging Element
          3. The invoker-proxy-binding-name Element
          4. The sync-on-commit-only Element
          5. The insert-after-ejb-post-create Element
          6. The call-ejb-store-on-clean Element
          7. The container-interceptors Element
          8. The instance-pool Element
          9. The container-pool-conf Element
          10. The instance-cache Element
          11. The container-cache-conf Element
          12. The persistence-manager Element
          13. The web-class-loader Element
          14. The locking-policy Element
          15. The commit-option and optiond-refresh-rate Elements
          16. The security-domain Element
          17. The cluster-config Element
      2. The Container Plug-in Framework
        1. The org.jboss.ejb.ContainerPlugin Interface
        2. The org.jboss.ejb.Interceptor Interface
        3. The org.jboss.ejb.InstancePool Interface
        4. The org.jboss.ebj.InstanceCache Interface
        5. The org.jboss.ejb.EntityPersistenceManager Interface
        6. The org.jboss.ejb.EntityPersistenceStore Interface
        7. The org.jboss.ejb.StatefulSessionPersistenceManager Interface
    4. Entity Bean Locking and Deadlock Detection
      1. Why JBoss Needs Locking
      2. The Entity Bean Life Cycle
      3. Default Locking Behavior
      4. Pluggable Interceptors and Locking Policy
      5. Deadlocking
        1. Deadlock Detection
        2. Catching ApplicationDeadlockException
        3. Viewing Lock Information
      6. Advanced Configurations and Optimizations
        1. Short-Lived Transactions
        2. Ordered Access
        3. Read-only Beans
        4. Explicitly Defining Read-only Methods
        5. The Instance per Transaction Policy
      7. Running Within a Cluster
      8. Troubleshooting
        1. Locking Behavior Not Working
        2. Hangs and Transaction Timeouts
  10. 6. Messaging on JBoss
    1. JMS Examples
      1. A Point-to-Point Example
      2. A Pub-Sub Example
      3. An Example of a Pub-Sub with a Durable Topic
      4. An Example of P2P with MDB
    2. JBossMQ Overview
      1. The Invocation Layer Services
      2. The SecurityManager Service
      3. The DestinationManager Service
      4. The MessageCache Service
      5. The StateManager Service
      6. The PersistenceManager Service
      7. Destinations
        1. Queues
        2. Topics
    3. JBossMQ Configuration and MBeans
      1. The org.jboss.mq.il.jvm.JVMServerILService MBean
      2. The org.jboss.mq.il.uil2.UILServerILService MBean
        1. Configuring UIL2 for SSL
        2. JMS Client Properties for the UIL2 Transport
      3. The org.jboss.mq.il.http.HTTPServerILService MBean
      4. The org.jboss.mq.server.jmx.Invoker MBean
      5. The org.jboss.mq.server.jmx.InterceptorLoader MBean
      6. The org.jboss.mq.sm.jdbc.JDBCStateManager MBean
      7. The org.jboss.mq.security.SecurityManager MBean
      8. The org.jboss.mq.server.jmx.DestinationManager MBean
      9. The org.jboss.mq.server.MessageCache MBean
      10. The org.jboss.mq.pm.jdbc2.PersistenceManager MBean
      11. Destination MBeans
        1. The org.jboss.mq.server.jmx.Queue MBean
        2. The org.jboss.mq.server.jmx.Topic MBean
    4. Specifying the MDB JMS Provider
      1. The org.jboss.jms.jndi.JMSProviderLoader MBean
      2. The org.jboss.jms.asf.ServerSessionPoolLoader MBean
      3. Integrating Non-JBoss JMS Providers
  11. 7. Connectors on JBoss
    1. JCA Overview
    2. An Overview of the JBossCX Architecture
      1. The BaseConnectionManager2 MBean
      2. The RARDeployment MBean
      3. The JBossManagedConnectionPool MBean
      4. The CachedConnectionManager MBean
      5. A Sample Skeleton of a JCA Resource Adaptor
    3. Configuring JDBC Datasources
    4. Configuring Generic JCA Adaptors
  12. 8. Security on JBoss
    1. J2EE Declarative Security Overview
      1. Security References
      2. Security Identity
      3. Security Roles
      4. EJB Method Permissions
      5. Web Content Security Constraints
      6. Enabling Declarative Security in JBoss
    2. An Introduction to JAAS
      1. What Is JAAS?
        1. The JAAS Core Classes
          1. The Subject and Principal Classes
          2. Authentication of a Subject
    3. The JBoss Security Model
      1. Enabling Declarative Security in JBoss, Revisited
    4. The JBossSX Architecture
      1. How JaasSecurityManager Uses JAAS
      2. The JaasSecurityManagerService MBean
      3. The JaasSecurityDomain MBean
      4. An XML JAAS Login Configuration MBean
      5. The JAAS Login Configuration Management MBean
      6. Using and Writing JBossSX Login Modules
        1. Writing Custom Login Modules
        2. Support for the Subject Usage Pattern
        3. A Custom LoginModule Example
      7. The DynamicLoginConfig Service
    5. The Secure Remote Password (SRP) Protocol
      1. Providing Password Information for SRP
      2. Inside the SRP Algorithm
        1. An SRP Example
    6. Running JBoss with a Java 2 Security Manager
    7. Using SSL with JBoss and JSSE
    8. Configuring JBoss for Use Behind a Firewall
    9. Securing the JBoss Server
      1. The jmx-console.war Service
      2. The web-console.war Service
      3. The http-invoker.sar Service
      4. The jmx-invoker-adaptor-server.sar Service
  13. 9. Web Applications
    1. The Tomcat Service
    2. The Tomcat server.xml File
      1. The Connector Element
    3. The Engine Element
    4. The Host Element
      1. The DefaultContext Element
      2. The Logger Element
      3. The Valve Element
    5. Using SSL with the JBoss/Tomcat Bundle
    6. Setting the Context Root of a Web Application
    7. Setting Up Virtual Hosts
    8. Serving Static Content
    9. Using Apache with Tomcat
    10. Using Clustering
    11. Integrating Third-Party Servlet Containers
      1. The AbstractWebContainer Class
        1. The AbstractWebContainer Contract
        2. Creating an AbstractWebContainer Subclass
          1. Using the Thread Context Class Loader
          2. Integrating Logging by Using log4j
          3. Delegating Web Container Authentication and Authorization to JBossSX
  14. 10. MBean Services Miscellany
    1. System Properties Management
    2. Property Editor Management
    3. Services Binding Management
    4. Scheduling Tasks
      1. The org.jboss.varia.scheduler.Scheduler MBean
    5. The Log4j Service MBean
    6. RMI Dynamic Class Loading
  15. 11. The CMP Engine
    1. Example Code
      1. Enabling CMP Debug Logging
      2. Running the Examples
    2. The jbosscmp-jdbc Structure
    3. Entity Beans
      1. Entity Mapping
    4. CMP Fields
      1. CMP Field Declaration
      2. CMP Field Column Mapping
      3. Read-only Fields
      4. Auditing Entity Access
      5. Dependent Value Classes
    5. Container-Managed Relationships
      1. CMR-field Abstract Accessors
      2. Relationship Declaration
      3. Relationship Mapping
        1. Relationship Role Mapping
        2. Foreign Key Mapping
        3. Relation Table Mapping
    6. Declaring Queries
      1. Declaring Finders and Selects
      2. Declaring EJB-QL Queries
      3. Overriding the Mapping of EJB-QL to SQL
      4. JBossQL
      5. DynamicQL
      6. DeclaredSQL
        1. Parameters
      7. EJB-QL 2.1 and SQL92 Queries
      8. BMP Custom Finders
    7. Optimized Loading
      1. A Loading Scenario
      2. Load Groups
      3. Read-ahead
        1. The on-find Strategy
        2. The left-join read-ahead Strategy
        3. D#findByPrimaryKey
        4. D#findAll
        5. A#findAll
        6. A#findMeParentGrandParent
        7. The on-load Strategy
          1. The none Strategy
    8. The Loading Process
      1. Commit Options
      2. The Eager-Loading Process
      3. The Lazy-Loading Process
        1. Relationships
      4. Lazy-Loading Result Sets
    9. Transactions
    10. Optimistic Locking
    11. Entity Commands and Primary Key Generation
      1. Existing Entity Commands
    12. JBoss Global Defaults
      1. A Sample jbosscmp-jdbc.xml Defaults Declaration
    13. Datasource Customization
      1. Type Mapping
      2. Function Mapping
      3. Mapping
      4. User Type Mappings
  16. 12. Web Services
    1. JAX-RPC Service Endpoints
    2. Enterprise JavaBean Endpoints
    3. Web Services Clients—A JAX-RPC Client
    4. Service References
  17. 13. Hibernate
    1. The Hibernate MBean
    2. Hibernate Archives
    3. Using Hibernate Objects
    4. Using a HAR File Inside an EAR File
    5. The HAR Deployer
  18. 14. Aspect-Oriented Programming (AOP) Support
    1. JBoss AOP: EJB-Style Services for Plain Java Objects
    2. Why AOP?
    3. Basic Concepts of AOP
      1. Joinpoints and Invocation
      2. Advice and Aspects
      3. Introducing Pointcuts
        1. Using an XML Configuration File
        2. Using Annotations
        3. Using Annotation in Application Classes
      4. Introductions and Mixins
    4. Building JBoss AOP Applications
      1. Compiling to Bytecode
      2. Compiling Annotations
      3. AOP Instrumentation
    5. The JBoss AOP Deployer
      1. Installing the Latest jboss-aop.deployer Service
      2. Configuring the AOP Service
      3. The Prepackaged Aspects Library
    6. Packaging and Deploying AOP Applications to JBoss
      1. Using Prepackaged Aspects
      2. Developing Your Own Aspects
      3. Packaging and Deploying Custom Aspects
  19. A. The GNU Lesser General Public License (LGPL)
    1. GNU General Public License
      1. Preamble
      2. Terms and Conditions for Copying, Distribution, and Modification
        1. No Warranty
        2. End Of Terms and Conditions
      3. How to Apply These Terms to Your New Programs
  20. B. Example Installation