The Jboss 4 Application Server Guide
Total Page:16
File Type:pdf, Size:1020Kb
The JBoss 4 Application Server Guide JBoss AS 4.0.4 Release 5 Copyright © 2004, 2005, 2006> 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 running JBoss ................................................................................................................1 1.1. Installing JBoss ........................................................................................................................1 1.2. Directory Structure ...................................................................................................................5 1.3. The Default Server Configuration File Set .................................................................................7 1.4. Starting and Stopping JBoss ....................................................................................................13 2. The JBoss JMX Microkernel .............................................................................................................16 2.1. An Introduction to JMX ..........................................................................................................16 2.1.1. Instrumentation Level ..................................................................................................18 2.1.2. Agent Level ................................................................................................................18 2.1.3. Distributed Services Level ...........................................................................................19 2.1.4. JMX Component Overview ..........................................................................................19 2.1.4.1. Managed Beans or MBeans ...............................................................................20 2.1.4.2. Notification Model ...........................................................................................20 2.1.4.3. MBean Metadata Classes ..................................................................................20 2.1.4.4. MBean Server ..................................................................................................21 2.1.4.5. Agent Services .................................................................................................21 2.2. JBoss JMX Implementation Architecture .................................................................................22 2.2.1. The JBoss ClassLoader Architecture .............................................................................22 2.2.2. Class Loading and Types in Java ..................................................................................22 2.2.2.1. ClassCastExceptions - I'm Not Your Type ..........................................................22 2.2.2.2. IllegalAccessException - Doing what you should not ..........................................27 2.2.2.3. LinkageErrors - Making Sure You Are Who You Say You Are ...........................29 2.2.2.4. Inside the JBoss Class Loading Architecture .......................................................34 2.2.3. JBoss XMBeans ..........................................................................................................41 2.2.3.1. Descriptors .......................................................................................................42 2.2.3.2. The Management Class .....................................................................................44 2.2.3.3. The Constructors ..............................................................................................44 2.2.3.4. The Attributes ..................................................................................................45 2.2.3.5. The Operations .................................................................................................46 2.2.3.6. Notifications .....................................................................................................47 2.3. Connecting to the JMX Server ................................................................................................48 2.3.1. Inspecting the Server - the JMX Console Web Application ............................................48 2.3.1.1. Securing the JMX Console ................................................................................50 2.3.2. Connecting to JMX Using RMI ....................................................................................52 JBoss Release 5 ii The JBoss 4 Application Server Guide 2.3.3. Command Line Access to JMX ....................................................................................55 2.3.3.1. Connecting twiddle to a Remote Server ..............................................................55 2.3.3.2. Sample twiddle Command Usage ......................................................................55 2.3.4. Connecting to JMX Using Any Protocol .......................................................................58 2.4. Using JMX as a Microkernel ...................................................................................................59 2.4.1. The Startup Process .....................................................................................................59 2.4.2. JBoss MBean Services .................................................................................................60 2.4.2.1. The SARDeployer MBean .................................................................................61 2.4.2.2. The Service Life Cycle Interface ........................................................................64 2.4.2.3. The ServiceController MBean ...........................................................................64 2.4.2.4. Specifying Service Dependencies ......................................................................66 2.4.2.5. Identifying Unsatisfied Dependencies ................................................................67 2.4.2.6. Hot Deployment of Components, the URLDeploymentScanner ...........................68 2.4.3. Writing JBoss MBean Services ....................................................................................69 2.4.3.1. A Standard MBean Example .............................................................................70 2.4.3.2. XMBean Examples ...........................................................................................73 2.4.4. Deployment Ordering and Dependencies ......................................................................81 2.5. JBoss Deployer Architecture ...................................................................................................90 2.5.1. Deployers and ClassLoaders ........................................................................................92 2.6. Remote Access to Services, Detached Invokers ........................................................................94 2.6.1. A Detached Invoker Example, the MBeanServer Invoker Adaptor Service ......................96 2.6.2. Detached Invoker Reference ......................................................................................100 2.6.2.1. The JRMPInvoker - RMI/JRMP Transport .......................................................100 2.6.2.2. The PooledInvoker - RMI/Socket Transport .....................................................101 2.6.2.3. The IIOPInvoker - RMI/IIOP Transport ...........................................................102 2.6.2.4. The JRMPProxyFactory Service - Building Dynamic JRMP Proxies ..................102 2.6.2.5. The HttpInvoker - RMI/HTTP Transport ..........................................................102 2.6.2.6. The HA JRMPInvoker - Clustered RMI/JRMP Transport ..................................103 2.6.2.7. The HA HttpInvoker - Clustered RMI/HTTP Transport .....................................103 2.6.2.8. HttpProxyFactory - Building Dynamic HTTP Proxies .......................................103 2.6.2.9. Steps to Expose Any RMI Interface via HTTP ..................................................104 3. Naming on JBoss ............................................................................................................................106 3.1. An Overview of JNDI ..........................................................................................................106