The Jboss 4 Application Server Guide
Total Page:16
File Type:pdf, Size:1020Kb
The JBoss 4 Application Server Guide JBoss AS 4.0.3 Release 4 Copyright © 2004, 2005 JBoss, Inc. Table of Contents What this Book Covers ........................................................................................................................ xii About JBoss ....................................................................................................................................... xiii About Open Source .............................................................................................................................xiv About Professional Open Source ...........................................................................................................xv What's new in JBoss 4 ..........................................................................................................................xvi 1. J2EE Certification and Standards Compliance ...........................................................................xvi 2. New Services Types ................................................................................................................xvii 3. JBoss AOP Support .................................................................................................................xvii 4. Hibernate Integration .............................................................................................................xviii 5. Clustering and Caching ..........................................................................................................xviii 1. Installing and Building the JBoss Server ...............................................................................................1 1.1. Installing JBoss ........................................................................................................................1 1.2. Directory Structure ...................................................................................................................2 1.3. The Default Server Configuration File Set .................................................................................4 1.4. Basic Installation Testing ..........................................................................................................9 1.5. Booting from a Network Server ...............................................................................................11 2. The JBoss JMX Microkernel .............................................................................................................13 2.1. JMX ......................................................................................................................................13 2.1.1. An Introduction to JMX ...............................................................................................14 2.1.1.1. Instrumentation Level .......................................................................................15 2.1.1.2. Agent Level .....................................................................................................15 2.1.1.3. Distributed Services Level .................................................................................16 2.1.1.4. JMX Component Overview ...............................................................................16 2.2. JBoss JMX Implementation Architecture .................................................................................19 2.2.1. The JBoss ClassLoader Architecture .............................................................................19 2.2.2. Class Loading and Types in Java ..................................................................................19 2.2.2.1. ClassCastExceptions - I'm Not Your Type ..........................................................19 2.2.2.2. IllegalAccessException - Doing what you should not ..........................................24 2.2.2.3. LinkageErrors - Making Sure You Are Who You Say You Are ...........................26 2.2.2.4. Inside the JBoss Class Loading Architecture .......................................................31 2.2.3. JBoss XMBeans ..........................................................................................................38 2.2.3.1. Descriptors .......................................................................................................39 2.2.3.2. The Management Class .....................................................................................41 2.2.3.3. The Constructors ..............................................................................................41 2.2.3.4. The Attributes ..................................................................................................42 2.2.3.5. The Operations .................................................................................................43 2.2.3.6. Notifications .....................................................................................................44 2.3. Connecting to the JMX Server ................................................................................................45 2.3.1. Inspecting the Server - the JMX Console Web Application ............................................45 2.3.1.1. Securing the JMX Console ................................................................................47 2.3.2. Connecting to JMX Using RMI ....................................................................................49 2.3.3. Command Line Access to JMX ....................................................................................52 2.3.3.1. Connecting twiddle to a Remote Server ..............................................................52 2.3.3.2. Sample twiddle Command Usage ......................................................................52 JBoss Release 4 ii The JBoss 4 Application Server Guide 2.3.4. Connecting to JMX Using Any Protocol .......................................................................55 2.4. Using JMX as a Microkernel ...................................................................................................56 2.4.1. The Startup Process .....................................................................................................56 2.4.2. JBoss MBean Services .................................................................................................57 2.4.2.1. The SARDeployer MBean .................................................................................58 2.4.2.2. The Service Life Cycle Interface ........................................................................61 2.4.2.3. The ServiceController MBean ...........................................................................61 2.4.2.4. Specifying Service Dependencies ......................................................................63 2.4.2.5. Identifying Unsatisfied Dependencies ................................................................64 2.4.2.6. Hot Deployment of Components, the URLDeploymentScanner ...........................65 2.4.3. Writing JBoss MBean Services ....................................................................................66 2.4.3.1. A Standard MBean Example .............................................................................67 2.4.3.2. XMBean Examples ...........................................................................................70 2.4.4. Deployment Ordering and Dependencies ......................................................................78 2.5. JBoss Deployer Architecture ...................................................................................................87 2.5.1. Deployers and ClassLoaders ........................................................................................89 2.6. Exposing MBean Events via SNMP ........................................................................................91 2.6.1. The Event to Trap Service ............................................................................................92 2.7. Remote Access to Services, Detached Invokers ........................................................................92 2.7.1. A Detached Invoker Example, the MBeanServer Invoker Adaptor Service ......................95 2.7.2. Detached Invoker Reference ........................................................................................99 2.7.2.1. The JRMPInvoker - RMI/JRMP Transport .........................................................99 2.7.2.2. The PooledInvoker - RMI/Socket Transport .....................................................100 2.7.2.3. The IIOPInvoker - RMI/IIOP Transport ...........................................................100 2.7.2.4. The JRMPProxyFactory Service - Building Dynamic JRMP Proxies ..................101 2.7.2.5. The HttpInvoker - RMI/HTTP Transport ..........................................................101 2.7.2.6. The HA JRMPInvoker - Clustered RMI/JRMP Transport ..................................102 2.7.2.7. The HA HttpInvoker - Clustered RMI/HTTP Transport .....................................102 2.7.2.8. HttpProxyFactory - Building Dynamic HTTP Proxies .......................................102 2.7.2.9. Steps to Expose Any RMI Interface via HTTP ..................................................103 3. Naming on JBoss ............................................................................................................................105 3.1. An Overview of JNDI ..........................................................................................................105 3.1.1. Names ......................................................................................................................105