The Jboss 4 Application Server J2EE Reference
Total Page:16
File Type:pdf, Size:1020Kb
The JBoss 4 Application Server J2EE Reference JBoss AS 4.0.5 Release 2 Copyright © 2006 JBoss, Inc. Table of Contents 1. The JBoss JMX Microkernel ...............................................................................................................1 1.1. An Introduction to JMX ............................................................................................................1 1.1.1. Instrumentation Level ....................................................................................................3 1.1.2. Agent Level ..................................................................................................................3 1.1.3. Distributed Services Level .............................................................................................4 1.1.4. JMX Component Overview ............................................................................................4 1.1.4.1. Managed Beans or MBeans .................................................................................5 1.1.4.2. Notification Model .............................................................................................5 1.1.4.3. MBean Metadata Classes ....................................................................................5 1.1.4.4. MBean Server ....................................................................................................6 1.1.4.5. Agent Services ...................................................................................................6 1.2. JBoss JMX Implementation Architecture ...................................................................................7 1.2.1. The JBoss ClassLoader Architecture ...............................................................................7 1.2.2. Class Loading and Types in Java ....................................................................................7 1.2.2.1. ClassCastExceptions - I'm Not Your Type ............................................................7 1.2.2.2. IllegalAccessException - Doing what you should not ..........................................12 1.2.2.3. LinkageErrors - Making Sure You Are Who You Say You Are ...........................14 1.2.2.4. Inside the JBoss Class Loading Architecture .......................................................19 1.2.3. JBoss XMBeans ..........................................................................................................26 1.2.3.1. Descriptors .......................................................................................................27 1.2.3.2. The Management Class .....................................................................................29 1.2.3.3. The Constructors ..............................................................................................29 1.2.3.4. The Attributes ..................................................................................................30 1.2.3.5. The Operations .................................................................................................31 1.2.3.6. Notifications .....................................................................................................32 1.3. Connecting to the JMX Server ................................................................................................33 1.3.1. Inspecting the Server - the JMX Console Web Application ............................................33 1.3.1.1. Securing the JMX Console ................................................................................35 1.3.2. Connecting to JMX Using RMI ....................................................................................37 1.3.3. Command Line Access to JMX ....................................................................................40 1.3.3.1. Connecting twiddle to a Remote Server ..............................................................40 1.3.3.2. Sample twiddle Command Usage ......................................................................40 1.3.4. Connecting to JMX Using Any Protocol .......................................................................43 1.4. Using JMX as a Microkernel ...................................................................................................44 1.4.1. The Startup Process .....................................................................................................44 1.4.2. JBoss MBean Services .................................................................................................45 1.4.2.1. The SARDeployer MBean .................................................................................46 1.4.2.2. The Service Life Cycle Interface ........................................................................49 1.4.2.3. The ServiceController MBean ...........................................................................49 1.4.2.4. Specifying Service Dependencies ......................................................................51 1.4.2.5. Identifying Unsatisfied Dependencies ................................................................52 1.4.2.6. Hot Deployment of Components, the URLDeploymentScanner ...........................53 1.4.3. Writing JBoss MBean Services ....................................................................................54 1.4.3.1. A Standard MBean Example .............................................................................55 JBoss Release 2 ii The JBoss 4 Application Server J2EE Reference 1.4.3.2. XMBean Examples ...........................................................................................58 1.4.4. Deployment Ordering and Dependencies ......................................................................65 1.5. JBoss Deployer Architecture ...................................................................................................75 1.5.1. Deployers and ClassLoaders ........................................................................................76 1.6. Remote Access to Services, Detached Invokers ........................................................................78 1.6.1. A Detached Invoker Example, the MBeanServer Invoker Adaptor Service ......................80 1.6.2. Detached Invoker Reference ........................................................................................84 1.6.2.1. The JRMPInvoker - RMI/JRMP Transport .........................................................84 1.6.2.2. The PooledInvoker - RMI/Socket Transport .......................................................85 1.6.2.3. The IIOPInvoker - RMI/IIOP Transport .............................................................86 1.6.2.4. The JRMPProxyFactory Service - Building Dynamic JRMP Proxies ....................86 1.6.2.5. The HttpInvoker - RMI/HTTP Transport ............................................................86 1.6.2.6. The HA JRMPInvoker - Clustered RMI/JRMP Transport ....................................87 1.6.2.7. The HA HttpInvoker - Clustered RMI/HTTP Transport .......................................87 1.6.2.8. HttpProxyFactory - Building Dynamic HTTP Proxies .........................................87 1.6.2.9. Steps to Expose Any RMI Interface via HTTP ....................................................88 2. Naming on JBoss ..............................................................................................................................90 2.1. An Overview of JNDI ............................................................................................................90 2.1.1. Names ........................................................................................................................90 2.1.2. Contexts .....................................................................................................................91 2.1.2.1. Obtaining a Context using InitialContext ............................................................91 2.2. The JBossNS Architecture ......................................................................................................92 2.3. The Naming InitialContext Factories .......................................................................................95 2.3.1. The standard naming context factory ............................................................................95 2.3.2. The org.jboss.naming.NamingContextFactory ...............................................................96 2.3.3. Naming Discovery in Clustered Environments ..............................................................96 2.3.4. The HTTP InitialContext Factory Implementation .........................................................97 2.3.5. The Login InitialContext Factory Implementation .........................................................98 2.3.6. The ORBInitialContextFactory .....................................................................................98 2.4. JNDI over HTTP ....................................................................................................................99 2.4.1. Accessing JNDI over HTTP .........................................................................................99 2.4.2. Accessing JNDI over HTTPS .....................................................................................102 2.4.3. Securing Access to JNDI over HTTP ..........................................................................104 2.4.4. Securing Access to JNDI with a Read-Only Unsecured Context ...................................105 2.5. Additional Naming MBeans ..................................................................................................107