This section covers configuring JBoss Portal to function in a clustered environment.
JBoss Portal leverages various clustered services that are found in JBoss Application Server. This section briefly details how each is leveraged:
JBoss Cache: Used to replicate data among the different hibernate session factories that are deployed in each node of the cluster. It is also used by the authorization framework to replicate data among the different policies.
JBoss HA Singleton:
HA-JNDI: Used to replicate a proxy that will talk to the HA CMS on the cluster.
If you have obtained the JBoss Portal source files, you can build JBoss Portal to work on a cluster in a simple process:
# Build the portal for single or clustered environment portal.clustered=false
If you have the binary version of JBoss Portal, you will need to edit several files manually that would normally be editted for you by the build. The list below details the files and code blocks that need to be modified in each:
jboss-portal.sar/META-INF/jboss-service.xml
<!-- | Uncomment in cluster mode : have the deployment of objects run as a clustered singleton @portal.single.xml.close@ <mbean code="org.jboss.ha.singleton.HASingletonController" name="portal:service=Controller,target=ObjectDeploymentFactory"> <depends>jboss:service=${jboss.partition.name:DefaultPartition}</depends> <depends>portal:deploymentFactory=Object</depends> <attribute name="TargetName">portal:deploymentFactory=Object</attribute> <attribute name="TargetStartMethod">registerFactory</attribute> <attribute name="TargetStopMethod">unregisterFactory</attribute> </mbean> @portal.single.xml.open@ -->
jboss-portal.sar/portal-cms.sar/META-INF/jboss-service.xml
<!-- | Uncomment in clustered mode : replicated cache for hibernate @portal.single.xml.close@ <mbean code="org.jboss.invocation.jrmp.server.JRMPProxyFactory" name="portal:service=ProxyFactory,type=CMS"> <depends optional-attribute-name="InvokerName">jboss:service=invoker,type=jrmp</depends> <attribute name="TargetName">portal:service=CMS</attribute> <attribute name="ExportedInterfaces">org.jboss.portal.cms.ha.HASingletonInvokerMBean$Proxy</attribute> <attribute name="InvokeTargetMethod">true</attribute> <attribute name="ClientInterceptors"> <interceptors> <interceptor>org.jboss.proxy.ClientMethodInterceptor</interceptor> <interceptor>org.jboss.invocation.InvokerInterceptor</interceptor> </interceptors> </attribute> </mbean> <mbean code="org.jboss.portal.cms.ha.HASingletonInvoker" name="portal:service=HASingletonInvoker,type=CMS"> <depends>jboss:service=${jboss.partition.name:DefaultPartition}</depends> <attribute name="RetryWaitingTimeMS">2000</attribute> <attribute name="MaxRetries">5</attribute> <attribute name="JNDIName">MyServiceInvokeTarget</attribute> <attribute name="JNDIProperties"> java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces java.naming.provider.url=${jboss.bind.address:localhost}:1100 jnp.disableDiscovery=false jnp.partitionName=${jboss.partition.name:DefaultPartition} jnp.discoveryGroup=${jboss.partition.udpGroup:230.0.0.4} jnp.discoveryPort=1102 jnp.discoveryTTL=16 jnp.discoveryTimeout=5000 jnp.maxRetries=1 </attribute> <depends optional-attribute-name="Callback" proxy-type="attribute">portal:service=CMS</depends> <depends optional-attribute-name="ProxyFactory">portal:service=ProxyFactory,type=CMS</depends> </mbean> @portal.single.xml.open@ -->
jboss-portal.sar/portal-server.war/WEB-INF/web.xml
<!-- | Uncomment in clustered mode : use http session replication @portal.single.xml.close@ <distributable/> @portal.single.xml.open@ -->
jboss-portal.sar/conf/hibernate/instance/hibernate.cfg.xml, jboss-portal.sar/conf/hibernate/portal/hibernate.cfg.xml, and jboss-portal.sar/conf/hibernate/user/hibernate.cfg.xml
<!-- | Uncomment in clustered mode : use transactional replicated cache @portal.single.xml.close@ <property name="cache.provider_class">org.jboss.portal.core.hibernate.JMXTreeCacheProvider</property> <property name="cache.object_name">portal:service=TreeCacheProvider,type=hibernate</property> @portal.single.xml.open@ --> <!-- | Comment in clustered mode @portal.clustered.xml.close@ <property name="cache.provider_class">org.hibernate.cache.EhCacheProvider</property> @portal.clustered.xml.open@ --> <!-- Force the dialect instead of using autodetection --> <!-- <property name="dialect">org.hibernate.dialect.PostgreSQLDialect</property> -->
After modifying the above files, you can deploy the jboss-portal.sar and the appropriate datasource descriptor to JBOSS_HOME/server/all/deploy/*