The JBoss 4 Application Server Guide JBoss AS 4.0.3 Release 4 Copyright © 2004, 2005 JBoss, Inc. Table of Contents WhatthisBookCovers ........................................................................................................................ xii AboutJBoss ....................................................................................................................................... xiii AboutOpenSource .............................................................................................................................xiv AboutProfessionalOpenSource ...........................................................................................................xv What'snewinJBoss4..........................................................................................................................xvi 1.J2EECertificationandStandardsCompliance ...........................................................................xvi 2.NewServicesTypes ................................................................................................................xvii 3.JBossAOPSupport.................................................................................................................xvii 4.HibernateIntegration .............................................................................................................xviii 5.ClusteringandCaching ..........................................................................................................xviii 1.InstallingandBuildingtheJBossServer ...............................................................................................1 1.1.InstallingJBoss ........................................................................................................................1 1.2.DirectoryStructure ...................................................................................................................2 1.3.TheDefaultServerConfigurationFileSet .................................................................................4 1.4.BasicInstallationTesting ..........................................................................................................9 1.5.BootingfromaNetworkServer...............................................................................................11 2.TheJBossJMXMicrokernel .............................................................................................................13 2.1.JMX ......................................................................................................................................13 2.1.1.AnIntroductiontoJMX ...............................................................................................14 2.1.1.1.InstrumentationLevel .......................................................................................15 2.1.1.2.AgentLevel .....................................................................................................15 2.1.1.3.DistributedServicesLevel.................................................................................16 2.1.1.4.JMXComponentOverview ...............................................................................16 2.2.JBossJMXImplementationArchitecture .................................................................................19 2.2.1.TheJBossClassLoaderArchitecture .............................................................................19 2.2.2.ClassLoadingandTypesinJava ..................................................................................19 2.2.2.1.ClassCastExceptions-I'mNotYourType ..........................................................19 2.2.2.2.IllegalAccessException-Doingwhatyoushouldnot ..........................................24 2.2.2.3.LinkageErrors-MakingSureYouAreWhoYouSayYouAre ...........................26 2.2.2.4.InsidetheJBossClassLoadingArchitecture .......................................................31 2.2.3.JBossXMBeans ..........................................................................................................38 2.2.3.1.Descriptors .......................................................................................................39 2.2.3.2.TheManagementClass .....................................................................................41 2.2.3.3.TheConstructors ..............................................................................................41 2.2.3.4.TheAttributes ..................................................................................................42 2.2.3.5.TheOperations .................................................................................................43 2.2.3.6.Notifications.....................................................................................................44 2.3.ConnectingtotheJMXServer ................................................................................................45 2.3.1.InspectingtheServer-theJMXConsoleWebApplication ............................................45 2.3.1.1.SecuringtheJMXConsole ................................................................................47 2.3.2.ConnectingtoJMXUsingRMI ....................................................................................49 2.3.3.CommandLineAccesstoJMX ....................................................................................52 2.3.3.1.ConnectingtwiddletoaRemoteServer ..............................................................52 2.3.3.2.SampletwiddleCommandUsage ......................................................................52 JBossRelease4 ii TheJBoss4ApplicationServerGuide 2.3.4.ConnectingtoJMXUsingAnyProtocol .......................................................................55 2.4.UsingJMXasaMicrokernel ...................................................................................................56 2.4.1.TheStartupProcess .....................................................................................................56 2.4.2.JBossMBeanServices .................................................................................................57 2.4.2.1.TheSARDeployerMBean.................................................................................58 2.4.2.2.TheServiceLifeCycleInterface ........................................................................61 2.4.2.3.TheServiceControllerMBean ...........................................................................61 2.4.2.4.SpecifyingServiceDependencies ......................................................................63 2.4.2.5.IdentifyingUnsatisfiedDependencies ................................................................64 2.4.2.6.HotDeploymentofComponents,theURLDeploymentScanner ...........................65 2.4.3.WritingJBossMBeanServices ....................................................................................66 2.4.3.1.AStandardMBeanExample .............................................................................67 2.4.3.2.XMBeanExamples ...........................................................................................70 2.4.4.DeploymentOrderingandDependencies ......................................................................78 2.5.JBossDeployerArchitecture ...................................................................................................87 2.5.1.DeployersandClassLoaders ........................................................................................89 2.6.ExposingMBeanEventsviaSNMP ........................................................................................91 2.6.1.TheEventtoTrapService ............................................................................................92 2.7.RemoteAccesstoServices,DetachedInvokers ........................................................................92 2.7.1.ADetachedInvokerExample,theMBeanServerInvokerAdaptorService ......................95 2.7.2.DetachedInvokerReference ........................................................................................99 2.7.2.1.TheJRMPInvoker-RMI/JRMPTransport .........................................................99 2.7.2.2.ThePooledInvoker-RMI/SocketTransport .....................................................100 2.7.2.3.TheIIOPInvoker-RMI/IIOPTransport ...........................................................100 2.7.2.4.TheJRMPProxyFactoryService-BuildingDynamicJRMPProxies ..................101 2.7.2.5.TheHttpInvoker-RMI/HTTPTransport ..........................................................101 2.7.2.6.TheHAJRMPInvoker-ClusteredRMI/JRMPTransport ..................................102 2.7.2.7.TheHAHttpInvoker-ClusteredRMI/HTTPTransport .....................................102 2.7.2.8.HttpProxyFactory-BuildingDynamicHTTPProxies .......................................102 2.7.2.9.StepstoExposeAnyRMIInterfaceviaHTTP ..................................................103 3.NamingonJBoss ............................................................................................................................105 3.1.AnOverviewofJNDI ..........................................................................................................105 3.1.1.Names ......................................................................................................................105 3.1.2.Contexts ...................................................................................................................106 3.1.2.1.ObtainingaContextusingInitialContext ..........................................................106 3.2.TheJBossNSArchitecture ....................................................................................................107 3.3.TheNamingInitialContextFactories .....................................................................................110 3.3.1.Thestandardnamingcontextfactory ..........................................................................110 3.3.2.Theorg.jboss.naming.NamingContextFactory .............................................................111 3.3.3.NamingDiscoveryinClusteredEnvironments ............................................................111 3.3.4.TheHTTPInitialContextFactoryImplementation .......................................................112 3.3.5.TheLoginInitialContextFactoryImplementation .......................................................113 3.3.6.TheORBInitialContextFactory ...................................................................................113 3.4.JNDIoverHTTP ..................................................................................................................114 3.4.1.AccessingJNDIoverHTTP .......................................................................................114 3.4.2.AccessingJNDIoverHTTPS .....................................................................................117 3.4.3.SecuringAccesstoJNDIoverHTTP ..........................................................................119 3.4.4.SecuringAccesstoJNDIwithaRead-OnlyUnsecuredContext ...................................120 3.5.AdditionalNamingMBeans ..................................................................................................122 JBossRelease4 iii TheJBoss4ApplicationServerGuide 3.5.1.JNDIBindingManager ..............................................................................................122 3.5.2.Theorg.jboss.naming.NamingAliasMBean ................................................................123 3.5.3.org.jboss.naming.ExternalContextMBean ..................................................................124 3.5.4.Theorg.jboss.naming.JNDIViewMBean ....................................................................125 3.6.J2EEandJNDI-TheApplicationComponentEnvironment ...................................................128 3.6.1.ENCUsageConventions............................................................................................130 3.6.1.1.EnvironmentEntries .......................................................................................130 3.6.1.2.EJBReferences ..............................................................................................131 3.6.1.3.EJBReferenceswithjboss.xmlandjboss-web.xml ...........................................133 3.6.1.4.EJBLocalReferences .....................................................................................134 3.6.1.5.ResourceManagerConnectionFactoryReferences ...........................................135 3.6.1.6.ResourceManagerConnectionFactoryReferenceswithjboss.xmlandjboss-web.xml ...................................................................................................................................137 3.6.1.7.ResourceEnvironmentReferences ...................................................................137 3.6.1.8.ResourceEnvironmentReferencesandjboss.xml,jboss-web.xml ......................138 4.TransactionsonJBoss .....................................................................................................................140 4.1.Transaction/JTAOverview ...................................................................................................140 4.1.1.Pessimisticandoptimisticlocking ..............................................................................141 4.1.2.Thecomponentsofadistributedtransaction ................................................................141 4.1.3.Thetwo-phaseXAprotocol .......................................................................................142 4.1.4.Heuristicexceptions ..................................................................................................142 4.1.5.TransactionIDsandbranches .....................................................................................143 4.2.JBossTransactionInternals ...................................................................................................143 4.2.1.AdaptingaTransactionManagertoJBoss ...................................................................144 4.2.2.TheDefaultTransactionManager ...............................................................................144 4.2.2.1.org.jboss.tm.XidFactory ..................................................................................145 4.2.3.UserTransactionSupport ............................................................................................145 5.EJBsonJBoss ................................................................................................................................146 5.1.TheEJBClientSideView ....................................................................................................146 5.1.1.SpecifyingtheEJBProxyConfiguration .....................................................................149 5.2.TheEJBServerSideView ....................................................................................................153 5.2.1.DetachedInvokers-TheTransportMiddlemen ...........................................................153 5.2.2.TheHAJRMPInvoker-ClusteredRMI/JRMPTransport .............................................157 5.2.3.TheHAHttpInvoker-ClusteredRMI/HTTPTransport ...............................................157 5.3.TheEJBContainer ...............................................................................................................158 5.3.1.EJBDeployerMBean .................................................................................................158 5.3.1.1.VerifyingEJBdeployments .............................................................................159 5.3.1.2.DeployingEJBsIntoContainers ......................................................................159 5.3.1.3.Containerconfigurationinformation ................................................................160 5.3.2.ContainerPlug-inFramework ....................................................................................171 5.3.2.1.org.jboss.ejb.ContainerPlugin ..........................................................................171 5.3.2.2.org.jboss.ejb.Interceptor ..................................................................................172 5.3.2.3.org.jboss.ejb.InstancePool ...............................................................................173 5.3.2.4.org.jboss.ebj.InstanceCache .............................................................................174 5.3.2.5.org.jboss.ejb.EntityPersistenceManager............................................................175 5.3.2.6.Theorg.jboss.ejb.EntityPersistenceStoreinterface ............................................177 5.3.2.7.org.jboss.ejb.StatefulSessionPersistenceManager ..............................................180 5.4.EntityBeanLockingandDeadlockDetection ........................................................................181 5.4.1.WhyJBossNeedsLocking .........................................................................................181 JBossRelease4 iv TheJBoss4ApplicationServerGuide 5.4.2.EntityBeanLifecycle ................................................................................................182 5.4.3.DefaultLockingBehavior ..........................................................................................182 5.4.4.PluggableInterceptorsandLockingPolicy ..................................................................182 5.4.5.Deadlock ..................................................................................................................183 5.4.5.1.DeadlockDetection ........................................................................................184 5.4.5.2.CatchingApplicationDeadlockException .........................................................184 5.4.5.3.ViewingLockInformation ..............................................................................185 5.4.6.AdvancedConfigurationsandOptimizations ...............................................................185 5.4.6.1.Short-livedTransactions..................................................................................186 5.4.6.2.OrderedAccess ..............................................................................................186 5.4.6.3.Read-OnlyBeans ............................................................................................186 5.4.6.4.ExplicitlyDefiningRead-OnlyMethods ..........................................................186 5.4.6.5.InstancePerTransactionPolicy .......................................................................187 5.4.7.RunningWithinaCluster ...........................................................................................188 5.4.8.Troubleshooting ........................................................................................................188 5.4.8.1.LockingBehaviorNotWorking .......................................................................188 5.4.8.2.IllegalStateException ......................................................................................188 5.4.8.3.HangsandTransactionTimeouts .....................................................................188 6.MessagingonJBoss ........................................................................................................................189 6.1.JMSExamples .....................................................................................................................189 6.1.1.APoint-To-PointExample .........................................................................................189 6.1.2.APub-SubExample ..................................................................................................192 6.1.3.APub-SubWithDurableTopicExample ....................................................................196 6.1.4.APoint-To-PointWithMDBExample .......................................................................199 6.2.JBossMessagingOverview ..................................................................................................205 6.2.1.InvocationLayer .......................................................................................................205 6.2.2.SecurityManager ......................................................................................................206 6.2.3.DestinationManager..................................................................................................206 6.2.4.MessageCache..........................................................................................................206 6.2.5.StateManager ...........................................................................................................206 6.2.6.PersistenceManager ..................................................................................................206 6.2.7.Destinations ..............................................................................................................207 6.2.7.1.Queues ...........................................................................................................207 6.2.7.2.Topics ............................................................................................................207 6.3.JBossMessagingConfigurationandMBeans .........................................................................207 6.3.1.org.jboss.mq.il.jvm.JVMServerILService ....................................................................208 6.3.2.org.jboss.mq.il.uil2.UILServerILService .....................................................................208 6.3.2.1.ConfiguringUIL2forSSL ..............................................................................209 6.3.2.2.JMSclientpropertiesfortheUIL2transport .....................................................210 6.3.3.org.jboss.mq.il.http.HTTPServerILService ..................................................................211 6.3.4.org.jboss.mq.server.jmx.Invoker .................................................................................211 6.3.5.org.jboss.mq.server.jmx.InterceptorLoader ..................................................................212 6.3.6.org.jboss.mq.sm.jdbc.JDBCStateManager ...................................................................212 6.3.7.org.jboss.mq.security.SecurityManager .......................................................................212 6.3.8.org.jboss.mq.server.jmx.DestinationManager ..............................................................213 6.3.9.org.jboss.mq.server.MessageCache .............................................................................214 6.3.10.org.jboss.mq.pm.jdbc2.PersistenceManager...............................................................215 6.3.11.DestinationMBeans.................................................................................................217 6.3.11.1.org.jboss.mq.server.jmx.Queue ......................................................................217 JBossRelease4 v TheJBoss4ApplicationServerGuide 6.3.11.2.org.jboss.mq.server.jmx.Topic .......................................................................219 6.4.SpecifyingtheMDBJMSProvider .......................................................................................220 6.4.1.org.jboss.jms.jndi.JMSProviderLoaderMBean ............................................................221 6.4.2.org.jboss.jms.asf.ServerSessionPoolLoaderMBean .....................................................222 6.4.3.Integratingnon-JBossJMSProviders..........................................................................223 7.ConnectorsonJBoss .......................................................................................................................224 7.1.JCAOverview .....................................................................................................................224 7.2.AnOverviewoftheJBossCXArchitecture ............................................................................226 7.2.1.BaseConnectionManager2MBean ..............................................................................227 7.2.2.RARDeploymentMBean ...........................................................................................227 7.2.3.JBossManagedConnectionPoolMBean .......................................................................228 7.2.4.CachedConnectionManagerMBean ............................................................................229 7.2.5.ASampleSkeletonJCAResourceAdaptor .................................................................230 7.3.ConfiguringJDBCDataSources ............................................................................................235 7.4.ConfiguringGenericJCAAdaptors .......................................................................................245 8.SecurityonJBoss ............................................................................................................................249 8.1.J2EEDeclarativeSecurityOverview .....................................................................................249 8.1.1.SecurityReferences ...................................................................................................249 8.1.2.SecurityIdentity ........................................................................................................251 8.1.3.Securityroles ............................................................................................................252 8.1.4.EJBmethodpermissions ............................................................................................253 8.1.5.WebContentSecurityConstraints ..............................................................................257 8.1.6.EnablingDeclarativeSecurityinJBoss .......................................................................260 8.2.AnIntroductiontoJAAS ......................................................................................................260 8.2.1.WhatisJAAS? ..........................................................................................................260 8.2.1.1.TheJAASCoreClasses ..................................................................................260 8.3.TheJBossSecurityModel ....................................................................................................264 8.3.1.EnablingDeclarativeSecurityinJBossRevisited ........................................................266 8.4.TheJBossSecurityExtensionArchitecture ............................................................................270 8.4.1.HowtheJaasSecurityManagerUsesJAAS ..................................................................272 8.4.2.TheJaasSecurityManagerServiceMBean ....................................................................275 8.4.3.TheJaasSecurityDomainMBean ................................................................................277 8.4.4.AnXMLJAASLoginConfigurationMBean ..............................................................278 8.4.5.TheJAASLoginConfigurationManagementMBean ..................................................280 8.4.6.UsingandWritingJBossSXLoginModules................................................................281 8.4.6.1.org.jboss.security.auth.spi.IdentityLoginModule ...............................................281 8.4.6.2.org.jboss.security.auth.spi.UsersRolesLoginModule ..........................................282 8.4.6.3.org.jboss.security.auth.spi.LdapLoginModule ...................................................283 8.4.6.4.org.jboss.security.auth.spi.DatabaseServerLoginModule ...................................287 8.4.6.5.BaseCertLoginModule ....................................................................................288 8.4.6.6.org.jboss.security.auth.spi.RunAsLoginModule ................................................290 8.4.6.7.org.jboss.security.ClientLoginModule ..............................................................290 8.4.7.WritingCustomLoginModules .................................................................................291 8.4.7.1.SupportfortheSubjectUsagePattern ..............................................................292 8.4.7.2.ACustomLoginModuleExample ....................................................................296 8.4.8.TheDynamicLoginConfigservice ..............................................................................299 8.5.TheSecureRemotePassword(SRP)Protocol ........................................................................300 8.5.1.ProvidingPasswordInformationforSRP ....................................................................303 8.5.2.InsideoftheSRPalgorithm .......................................................................................305 JBossRelease4 vi TheJBoss4ApplicationServerGuide 8.5.2.1.AnSRPexample ............................................................................................307 8.6.RunningJBosswithaJava2securitymanager .......................................................................310 8.7.UsingSSLwithJBossusingJSSE .........................................................................................311 8.8.ConfiguringJBossforuseBehindaFirewall..........................................................................315 8.9.HowtoSecuretheJBossServer ............................................................................................316 8.9.1.Thejmx-console.war .................................................................................................316 8.9.2.Theweb-console.war .................................................................................................316 8.9.3.Thehttp-invoker.sar ..................................................................................................316 8.9.4.Thejmx-invoker-adaptor-server.sar ............................................................................317 9.WebApplications ...........................................................................................................................318 9.1.TheTomcatService .............................................................................................................318 9.2.Theserver.xmlfile ...............................................................................................................319 9.2.1.TheConnectorelement ..............................................................................................319 9.2.2.TheEngineelement ...................................................................................................321 9.2.3.TheHostelement ......................................................................................................321 9.2.4.TheValveelement.....................................................................................................321 9.3.Thecontext.xmlfile .............................................................................................................322 9.4.UsingSSLwiththeJBoss/Tomcatbundle ..............................................................................322 9.5.Settingthecontextrootofawebapplication ..........................................................................325 9.6.SettingupVirtualHosts ........................................................................................................326 9.7.ServingStaticContent ..........................................................................................................327 9.8.UsingApachewithTomcat ...................................................................................................328 9.9.UsingJavaServerFaces ........................................................................................................328 10.AdditionalServices .......................................................................................................................331 10.1.SystemPropertiesManagement ...........................................................................................331 10.2.PropertyEditorManagement...............................................................................................332 10.3.ServicesBindingManagement ............................................................................................332 10.4.SchedulingTasks ...............................................................................................................336 10.4.1.org.jboss.varia.scheduler.Scheduler ..........................................................................336 10.5.TheLog4jService ..............................................................................................................339 10.6.RMIDynamicClassLoading ..............................................................................................339 10.7.TheBarrierControllerService .............................................................................................340 11.TheCMPEngine ..........................................................................................................................343 11.1.ExampleCode ....................................................................................................................343 11.1.1.EnablingCMPDebugLogging .................................................................................345 11.1.2.Runningtheexamples ..............................................................................................345 11.2.Thejbosscmp-jdbcStructure ...............................................................................................346 11.3.EntityBeans ......................................................................................................................348 11.3.1.EntityMapping .......................................................................................................350 11.4.CMPFields ........................................................................................................................353 11.4.1.CMPFieldDeclaration ............................................................................................354 11.4.2.CMPFieldColumnMapping ...................................................................................354 11.4.3.Read-onlyFields .....................................................................................................356 11.4.4.AuditingEntityAccess ............................................................................................357 11.4.5.DependentValueClasses(DVCs) .............................................................................358 11.5.ContainerManagedRelationships .......................................................................................362 11.5.1.CMR-FieldAbstractAccessors.................................................................................362 11.5.2.RelationshipDeclaration ..........................................................................................363 11.5.3.RelationshipMapping ..............................................................................................364 JBossRelease4 vii TheJBoss4ApplicationServerGuide 11.5.3.1.RelationshipRoleMapping ...........................................................................365 11.5.3.2.ForeignKeyMapping ...................................................................................368 11.5.3.3.RelationtableMapping .................................................................................368 11.6.Queries ..............................................................................................................................370 11.6.1.FinderandselectDeclaration....................................................................................370 11.6.2.EJB-QLDeclaration ................................................................................................371 11.6.3.OverridingtheEJB-QLtoSQLMapping ..................................................................372 11.6.4.JBossQL .................................................................................................................374 11.6.5.DynamicQL ............................................................................................................375 11.6.6.DeclaredSQL ..........................................................................................................376 11.6.6.1.Parameters....................................................................................................379 11.6.7.EJBQL2.1andSQL92queries .................................................................................379 11.6.8.BMPCustomFinders ...............................................................................................380 11.7.OptimizedLoading .............................................................................................................380 11.7.1.LoadingScenario .....................................................................................................381 11.7.2.LoadGroups ...........................................................................................................382 11.7.3.Read-ahead .............................................................................................................383 11.7.3.1.on-find .........................................................................................................383 11.7.3.2.on-load .........................................................................................................387 11.7.3.3.none .............................................................................................................389 11.8.LoadingProcess .................................................................................................................389 11.8.1.CommitOptions ......................................................................................................389 11.8.2.Eager-loadingProcess ..............................................................................................390 11.8.3.LazyloadingProcess ...............................................................................................391 11.8.3.1.Relationships ................................................................................................392 11.8.4.Lazyloadingresultsets ............................................................................................394 11.9.Transactions .......................................................................................................................395 11.10.OptimisticLocking ...........................................................................................................397 11.11.EntityCommandsandPrimaryKeyGeneration ..................................................................400 11.11.1.ExistingEntityCommands .....................................................................................401 11.12.Defaults ...........................................................................................................................403 11.12.1.Asamplejbosscmp-jdbc.xmldefaultsdeclaration ....................................................405 11.13.DatasourceCustomization .................................................................................................406 11.13.1.TypeMapping .......................................................................................................407 11.13.2.FunctionMapping..................................................................................................410 11.13.3.Mapping................................................................................................................411 11.13.4.UserTypeMappings ..............................................................................................412 12.WebServices ................................................................................................................................414 12.1.JAX-RPCServiceEndpoints ...............................................................................................414 12.2.EJBEndpoints ...................................................................................................................419 12.3.WebServicesClients ..........................................................................................................421 12.3.1.AJAX-RPCclient ...................................................................................................421 12.3.2.Servicereferences ....................................................................................................423 13.Hibernate ......................................................................................................................................427 13.1.TheHibernateMBean.........................................................................................................427 13.2.DeployingHibernateapplications ........................................................................................429 13.2.1.DeployingasaHibernatearchive..............................................................................429 13.2.2.Scanningthedeployment .........................................................................................431 13.3.UsingtheHibernateobjects ................................................................................................432 JBossRelease4 viii TheJBoss4ApplicationServerGuide 14.TheJBossmicrocontainer ..............................................................................................................433 14.1.IntroductiontotheJBossMicrocontainer .............................................................................433 14.2.Beanarchives .....................................................................................................................433 14.3.BasicConfiguration ............................................................................................................433 14.3.1.Deployment ............................................................................................................434 14.3.2.Bean .......................................................................................................................434 14.3.3.Construction ............................................................................................................434 14.3.4.Factories .................................................................................................................435 14.3.5.Properties ................................................................................................................436 14.3.6.StringValues...........................................................................................................436 14.3.7.Injections ................................................................................................................437 14.3.8.Collections ..............................................................................................................439 14.3.9.Lifecycle .................................................................................................................440 14.4.Conclusion .........................................................................................................................441 15.AspectOrientedProgramming(AOP)Support ................................................................................442 15.1.WhyAOP ..........................................................................................................................442 15.2.AOPBasicConcepts ..........................................................................................................443 15.2.1.JoinpointandInvocation ..........................................................................................443 15.2.2.AdviceandAspect ...................................................................................................443 15.2.3.Pointcut ..................................................................................................................444 15.2.3.1.UseXMLconfigurationfile ...........................................................................444 15.2.3.2.Useannotations ............................................................................................444 15.2.3.3.UseAnnotationinApplicationClasses ...........................................................445 15.2.4.IntroductionandMixin ............................................................................................446 15.3.BuildJBossAOPApplications ............................................................................................447 15.3.1.Compiletobytecode ................................................................................................447 15.3.2.Compileannotation..................................................................................................447 15.3.3.AOPIntrumentation.................................................................................................448 15.4.JBossAOPDeployer ..........................................................................................................448 15.4.1.Installthelatestjboss-aop.deployer ...........................................................................449 15.4.2.ConfiguretheAOPservice .......................................................................................449 15.4.3.Pre-packagedaspectslibrary ....................................................................................450 15.5.PackageanddeployAOPapplicationstoJBoss ....................................................................450 15.5.1.Usepre-packagedaspects .........................................................................................452 15.5.2.Developyourownaspects ........................................................................................454 15.5.3.Packageanddeploycustomaspects ..........................................................................456 16.Clustering .....................................................................................................................................459 16.1.Introduction .......................................................................................................................459 16.1.1.ClusterDefinition ....................................................................................................459 16.1.2.ServiceArchitectures ...............................................................................................462 16.1.2.1.Client-sideinterceptor ...................................................................................462 16.1.2.2.Loadbalancer ...............................................................................................463 16.1.3.Load-BalancingPolicies ..........................................................................................464 16.1.3.1.JBossAS3.0.x .............................................................................................464 16.1.3.2.JBossAS3.2+ ..............................................................................................465 16.1.4.FarmingDeployment ...............................................................................................465 16.1.5.Distributedstatereplicationservices .........................................................................466 16.2.ClusteredJNDIServices .....................................................................................................466 16.2.1.Howitworks ...........................................................................................................467 JBossRelease4 ix TheJBoss4ApplicationServerGuide 16.2.2.Clientconfiguration .................................................................................................468 16.2.3.JBossconfiguration .................................................................................................469 16.3.ClusteredSessionEJBs .......................................................................................................471 16.3.1.StatelessSessionBeaninEJB2.x .............................................................................471 16.3.1.1.HandleClusterRestart ..................................................................................472 16.3.2.StatefulSessionBeaninEJB2.x ..............................................................................474 16.3.2.1.TheEJBapplicationconfiguration .................................................................474 16.3.2.2.Optimizestatereplication ..............................................................................474 16.3.2.3.TheHASessionStateserviceconfiguration .....................................................475 16.3.3.StatelessSessionBeaninEJB3.0 .............................................................................475 16.3.4.StatefulSessionBeaninEJB3.0 ..............................................................................476 16.4.ClusteredEntityEJBs .........................................................................................................477 16.4.1.EntityBeaninEJB2.x .............................................................................................477 16.4.2.EntityBeaninEJB3.0 .............................................................................................478 16.4.2.1.Configurethedistributedcache ......................................................................478 16.4.2.2.Configuretheentitybeansforcache...............................................................480 16.5.HTTPServices ...................................................................................................................481 16.5.1.Downloadthesoftware ............................................................................................481 16.5.2.ConfigureApachetoloadmod_jk ............................................................................482 16.5.3.Configureworkernodesinmod_jk ...........................................................................483 16.5.4.ConfigureJBoss ......................................................................................................484 16.5.5.ConfigureHTTPsessionstatereplication ..................................................................485 16.5.6.Enablingsessionreplicationinyourapplication .........................................................487 16.5.7.Monitoringsessionreplication ..................................................................................488 16.5.8.UsingSingleSignOn ..............................................................................................488 16.6.ClusteredJMSServices ......................................................................................................489 16.6.1.HighAvailabilitySingletonFail-over .......................................................................489 16.6.1.1.ServerSideConfiguration .............................................................................489 16.6.1.2.HA-JMSClient .............................................................................................490 16.6.1.3.LoadBalancedHA-JMSMDBs .....................................................................490 17.JBossCacheandJGroupsServices ..................................................................................................491 17.1.JGroupsConfiguration ........................................................................................................491 17.1.1.TransportProtocols..................................................................................................492 17.1.1.1.UDPconfiguration ........................................................................................493 17.1.1.2.TCPconfiguration ........................................................................................494 17.1.1.3.TUNNELconfiguration ................................................................................495 17.1.2.DiscoveryProtocols .................................................................................................495 17.1.2.1.PING ...........................................................................................................495 17.1.2.2.TCPGOSSIP ................................................................................................496 17.1.2.3.TCPPING.....................................................................................................496 17.1.2.4.MPING ........................................................................................................497 17.1.3.FailureDetectionProtocols ......................................................................................497 17.1.3.1.FD ...............................................................................................................497 17.1.3.2.FD_SOCK....................................................................................................498 17.1.3.3.FD_SIMPLE ................................................................................................498 17.1.4.ReliableDeliveryProtocols ......................................................................................499 17.1.4.1.UNICAST ....................................................................................................499 17.1.4.2.NAKACK ....................................................................................................499 17.1.5.OtherConfigurationOptions ....................................................................................500 JBossRelease4 x
Description: