Asim
HUSANOVIĆ
admin
Replace a String in Multiple Files in Linux Using Grep and Sed
2012.08.22 10:15:32

Example:

grep -rl 'windows' ./ | xargs sed -i 's/windows/linux/g'

 



Tags: linux | grep | sed | replace | find

Hits: 1010 | Read more...


 
admin
Increasing number of the JBoss ports
2012.08.22 08:58:06

Sometimes we need run more JBoss instancies on one machine. In that case we need to change some configuration files and add one new configuration file. Many peoples have a big problem with multiple JBoss instances on one machine. Here, I'll try to explain how to configure JBoss for easy switch ports.

1. Download 4.x.x JBoss version on your machine and unpack. (for this example I used linux)

2. Create <your_jboss_dir>/binding/binding.xml file with follow content: (For supporting multiple port please read commnets)

<?xml version="1.0" encoding="UTF-8"?>
<service-bindings>
 <!-- ********************************************************** -->
 <!-- * ports-default * -->
 <!-- ********************************************************** -->
 <server name="ports-default">
 <!-- ********************* jboss-service.xml ****************** -->
 <service-config name="jboss:service=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" hostName="BindAddress">
 <attribute name="RmiPort">1098</attribute>
 </delegate-config>
 <binding port="1099" host="${jboss.bind.address}" />
 </service-config>
 <service-config name="jboss:service=WebService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="8083" />
 </service-config>
 <service-config name="jboss:service=invoker,type=jrmp"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="4444" />
 </service-config>
 <service-config name="jboss:service=invoker,type=pooled"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="4445" />
 </service-config>
 <!-- ********************* cluster-service.xml **************** -->
 <service-config name="jboss:service=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" hostName="BindAddress">
 <attribute name="RmiPort">1101</attribute>
 </delegate-config>
 <binding port="1100" host="${jboss.bind.address}" />
 </service-config>
 <service-config name="jboss:service=invoker,type=jrmpha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="4444" />
 </service-config>
 <service-config name="jboss:service=invoker,type=pooledha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="4448" />
 </service-config>
 <!-- ********************* iiop-service.xml ****************** -->
 <service-config name="jboss:service=CorbaORB"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="3528" />
 </service-config>
 <!-- ********************* jmx-rmi-adaptor.sar **************** -->
 <service-config name="jboss.jmx:type=Connector,name=RMI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="19001" />
 </service-config>
 <!-- ********************* snmp-adaptor.sar ****************** -->
 <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="1162" />
 </service-config>
 <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="1161" />
 </service-config>
 <!-- ********************* jbossmq-service.xml **************** -->
 <!-- JMS related services -->
 <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="8093" />
 </service-config>
 <!-- ********************* jbossmq-httpil.sar **************** -->
 <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="URLPort" />
 <binding port="8080" />
 </service-config>
 <!-- ********************* hajndi-jms-ds.xml **************** -->
 <!-- The JMS provider loader -->
 <service-config
name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <!--
MAKE SURE java.naming.provider.url
PORT IS SAME AS HA-JNDI ABOVE !!!
-->
 <delegate-config>
 <attribute name="Properties">
 
<![CDATA[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>
 </delegate-config>
 <!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
 <binding port="1100" />
 </service-config>
 <!-- **************** http-invoker.sar & httpha-invoker.sar***************
-->
 <!-- EJBInvoker -->
 <service-config name="jboss:service=invoker,type=http"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8080" />
 </service-config>
 <!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->
 <service-config
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerLocator">socket://${jboss.bind.address}:3874</attribute>
 </delegate-config>
 <binding port="3874" />
 </service-config>
 <!-- JMXInvoker -->
 <service-config name="jboss:service=invoker,type=http,target=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8080" />
 </service-config>
 <!-- readonly JMXInvoker -->
 <service-config
name="jboss:service=invoker,type=http,target=Naming,readonly=true"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8080" />
 </service-config>
 <!-- **************** httpha-invoker.sar*************** -->
 <!-- EJBInvokerHA -->
 <service-config name="jboss:service=invoker,type=httpHA"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
 </delegate-config>
 <binding port="8080" />
 </service-config>
 <!-- JMXInvokerHA -->
 <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
 </delegate-config>
 <binding port="8080" />
 </service-config>
 <!-- ********************* jboss-ws4ee.sar **************** -->
 <!-- Web Service related services -->
 <service-config name="jboss.ws4ee:service=AxisService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="WebServicePort" hostName="WebServiceHost" />
 <binding port="8080" host="${jboss.bind.address}" />
 </service-config>
 <!-- ********************* remoting **************** -->
 <!-- *** remoting connector *** -->
 <service-config name="jboss.remoting:service=Connector,transport=socket"
delegateClass="org.jboss.services.binding.XSLTConfigDelegate">
 <delegate-config>
 <xslt-config configName="Configuration">
 <![CDATA[<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
 <xsl:output method="xml" />
 <xsl:param name="port"/>
 <xsl:template match="/">
 <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match="attribute[@name='serverBindPort']">
 <attribute type="java.lang.String" name="serverBindPort">
 <xsl:value-of select='$port'/>
 </attribute>
 </xsl:template>
 <xsl:template match="*|@*">;;
<xsl:copy>
 <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
 </xsl:template>
 </xsl:stylesheet>]]>
 </xslt-config>
 </delegate-config>
 <binding port="4446" />
 </service-config>
 <!-- ********************* tomcat ********************** -->
 <service-config name="jboss.web:service=WebServer"
delegateClass="org.jboss.services.binding.XSLTFileDelegate">
 <delegate-config>
 <xslt-config configName="ConfigFile">
 <![CDATA[<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
 <xsl:output method="xml" />
 <xsl:param name="port"/>
 <xsl:variable name="portAJP" select="$port - 71"/>
 <xsl:variable name="portHttps" select="$port + 363"/>
 <xsl:template match="/">
 <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match = "Connector">
 <Connector>
 <xsl:for-each select="@*">
 <xsl:choose>
 <xsl:when test="(name() = 'port' and . = '8080')">
 <xsl:attribute name="port">
 <xsl:value-of select="$port" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'port' and . = '8009')">
 <xsl:attribute name="port">
 <xsl:value-of select="$portAJP" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'redirectPort')">
 <xsl:attribute name="redirectPort">
 <xsl:value-of select="$portHttps" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'port' and . = '8443')">
 <xsl:attribute name="port">
 <xsl:value-of select="$portHttps" />
 </xsl:attribute>
 </xsl:when>
 <xsl:otherwise>
 <xsl:attribute name="{name()}">
 <xsl:value-of select="." />
 </xsl:attribute>
 </xsl:otherwise>
 </xsl:choose>
 </xsl:for-each>
 <xsl:apply-templates/>
 </Connector>
 </xsl:template>
 <xsl:template match="<a href="mailto:*|@*">">*|@*"></a>;;
<xsl:copy>
 <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
 </xsl:template>
 </xsl:stylesheet>]]>
 </xslt-config>
 </delegate-config>
 <binding port="8080" />
 </service-config>
 <!-- ********************* jboss messaging ********************** -->
 <service-config name="jboss.messaging:service=Connector,transport=bisocket"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute name="Configuration">
 <![CDATA[<config>
 <invoker transport="bisocket">
 <!-- There should be no reason to change these parameters - warning!
Changing them may stop JBoss Messaging working correctly -->
 <attribute name="marshaller"
isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
 <attribute name="unmarshaller"
isParam="true">org.jboss.jms.wireformat.JMSWireFormat</attribute>
 <attribute name="dataType" isParam="true">jms</attribute>
 <attribute name="socket.check_connection"
isParam="true">false</attribute>
 <attribute
name="serverBindAddress">${jboss.bind.address}</attribute>
 <attribute name="serverBindPort">4757</attribute>
 <attribute name="clientSocketClass"
isParam="true">org.jboss.jms.client.remoting.ClientSocketWrapper</attribute>
 <attribute
name="serverSocketClass">org.jboss.jms.server.remoting.ServerSocketWrapper</
attribute>
 <attribute name="numberOfCallRetries" isParam="true">1</attribute>
 <attribute name="pingFrequency" isParam="true">214748364</attribute>
 <attribute name="pingWindowFactor" isParam="true">10</attribute>
 <attribute
name="onewayThreadPool">org.jboss.jms.server.remoting.DirectThreadPool</
attribute>
 <!-- End immutable parameters -->
 <attribute name="stopLeaseOnFailure" isParam="true">true</attribute>
 <!-- Periodicity of client pings. Server window by default is twice
this figure -->
 <attribute name="clientLeasePeriod" isParam="true">10000</attribute>
 <attribute name="validatorPingPeriod"
isParam="true">10000</attribute>
 <attribute name="validatorPingTimeout"
isParam="true">5000</attribute>
 <attribute name="registerCallbackListener">false</attribute>
 <attribute name="timeout" isParam="true">0</attribute>
 <!-- Number of seconds to wait for a connection in the client pool
to become free -->
 <attribute name="numberOfRetries" isParam="true">10</attribute>
 <!-- Max Number of connections in client pool. This should be
significantly higher than
the max number of sessions/consumers you expect -->
 <attribute name="JBM_clientMaxPoolSize"
isParam="true">200</attribute>
 <!-- The maximum time to wait before timing out on trying to write a
message to socket for delivery -->
 <attribute name="callbackTimeout">10000</attribute>
 <!-- Use these parameters to specify values for binding and
connecting control connections to
work with your firewall/NAT configuration
<attribute name="secondaryBindPort">xyz</attribute>
 <attribute name="secondaryConnectPort">abc</attribute>
-->
 </invoker>
 <handlers>
 <handler
subsystem="JMS">org.jboss.jms.server.remoting.JMSServerInvocationHandler</
handler>
 </handlers>
 </config>]]>
 </attribute>
 </delegate-config>
 <binding port="4457" />
</service-config>
</server>
<!-- ********************************************************** -->
<!-- * ports-01 * -->
<!-- ********************************************************** -->
<server name="ports-01">
 <!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->
 <service-config
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerLocator">socket://${jboss.bind.address}:3973</attribute>
 </delegate-config>
 <binding port="3973" />
 </service-config>
 <!-- Can also be 4073, 4173, 4273 -->
 <!-- ********************* jboss-service.xml ****************** -->
 <service-config name="jboss:service=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" hostName="BindAddress">
 <attribute name="RmiPort">1198</attribute>
 <!-- Can also be 1298, 1398, 1498 -->
 </delegate-config>
 <binding port="1199" host="${jboss.bind.address}" />
 <!-- Can also be 1299, 1399, 1499 -->
 </service-config>
 <service-config name="jboss:service=WebService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="8183" />
 <!-- Can also be 8283, 8383, 8483 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=jrmp"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="4544" />
 <!-- Can also be 4644, 4744, 4844 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=pooled"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="4545" />
 <!-- Can also be 4645, 4745, 4845 -->
 </service-config>
 <!-- ********************* cluster-service.xml **************** -->
 <service-config name="jboss:service=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" hostName="BindAddress">
 <attribute name="RmiPort">1201</attribute>
 <!-- Can also be 1301, 1401, 1501 -->
 </delegate-config>
 <binding port="1200" host="${jboss.bind.address}" />
 <!-- Can also be 1300, 1400, 1500 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=jrmpha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="4544" />
 <!-- Can also be 4644, 4744, 4844 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=pooledha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="4546" />
 <!-- Can also be 4646, 4746, 4846 -->
 </service-config>
 <!-- ********************* iiop-service.xml ****************** -->
 <service-config name="jboss:service=CorbaORB"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="3628" />
 <!-- Can also be 3728, 3828, 3928 -->
 </service-config>
 <!-- ********************* jmx-rmi-adaptor.sar **************** -->
 <service-config name="jboss.jmx:type=Connector,name=RMI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="19101" />
 <!-- Can also be 19201, 19301, 19401 -->
 </service-config>
 <!-- ********************* snmp-adaptor.sar ****************** -->
 <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="1262" />
 <!-- Can also be 1362, 1462, 1562 -->
 </service-config>
 <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="1261" />
 <!-- Can also be 1361, 1461, 1561 -->
 </service-config>
 <!-- ********************* jbossmq-service.xml **************** -->
 <!-- JMS related services -->
 <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="8193" />
 <!-- Can also be 8293, 8393, 8493 -->
 </service-config>
 <!-- ********************* jbossmq-httpil.sar **************** -->
 <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="URLPort" />
 <binding port="8180" />
 <!-- Can be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* hajndi-jms-ds.xml **************** -->
 <!-- The JMS provider loader -->
 <service-config
name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <!--
MAKE SURE java.naming.provider.url
PORT IS SAME AS HA-JNDI ABOVE !!!
-->
 <delegate-config>
 <attribute name="Properties">
 
<![CDATA[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}:1200 <!-- Can also be
1300, 1400, 1500 -->
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>
 </delegate-config>
 <!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
 <binding port="1200" />
 <!-- Can also be 1300, 1400, 1500 -->
 </service-config>
 <!-- **************** http-invoker.sar & httpha-invoker.sar***************
-->
 <!-- EJBInvoker -->
 <service-config name="jboss:service=invoker,type=http"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8180" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- JMXInvoker -->
 <service-config name="jboss:service=invoker,type=http,target=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8180" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- readonly JMXInvoker -->
 <service-config
name="jboss:service=invoker,type=http,target=Naming,readonly=true"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8180" />
 <!-- Can be also 8280, 8380, 8480 -->
 </service-config>
 <!-- **************** httpha-invoker.sar*************** -->
 <!-- EJBInvokerHA -->
 <service-config name="jboss:service=invoker,type=httpHA"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
 </delegate-config>
 <binding port="8180" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- JMXInvokerHA -->
 <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
 </delegate-config>
 <binding port="8180" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* jboss-ws4ee.sar **************** -->
 <!-- Web Service related services -->
 <service-config name="jboss.ws4ee:service=AxisService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="WebServicePort" hostName="WebServiceHost" />
 <binding port="8180" host="${jboss.bind.address}" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* tomcat ********************** -->
 <service-config name="jboss.web:service=WebServer"
delegateClass="org.jboss.services.binding.XSLTFileDelegate">
 <delegate-config>
 <xslt-config configName="ConfigFile">
 <![CDATA[<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
 <xsl:output method="xml" />
 <xsl:param name="port"/>
 <xsl:variable name="portAJP" select="$port - 71"/>
 <xsl:variable name="portHttps" select="$port + 363"/>
 <xsl:template match="/">
 <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match = "Connector">
 <Connector>
 <xsl:for-each select="@*">
 <xsl:choose>
 <xsl:when test="(name() = 'port' and . = '8080')">
 <xsl:attribute name="port">
 <xsl:value-of select="$port" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'port' and . = '8009')">
 <xsl:attribute name="port">
 <xsl:value-of select="$portAJP" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'redirectPort')">
 <xsl:attribute name="redirectPort">
 <xsl:value-of select="$portHttps" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'port' and . = '8443')">
 <xsl:attribute name="port">
 <xsl:value-of select="$portHttps" />
 </xsl:attribute>
 </xsl:when>
 <xsl:otherwise>
 <xsl:attribute name="{name()}">
 <xsl:value-of select="." />
 </xsl:attribute>
 </xsl:otherwise>
 </xsl:choose>
 </xsl:for-each>
 <xsl:apply-templates/>
 </Connector>
 </xsl:template>
 <xsl:template match="*|@*">;;
<xsl:copy>
 <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
 </xsl:template>
 </xsl:stylesheet>]]>
 </xslt-config>
 </delegate-config>
 <binding port="8180" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* jboss messaging ********************** -->
 <service-config name="jboss.messaging:service=Connector,transport=socket"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerLocator">socket://${jboss.bind.address}:4557/?dataType=jms&amp;
serializationtype=jms&amp;timeout=0&amp;leasePeriod=20000&amp;socket.
check_connection=false&amp;marshaller=org.jboss.jms.server.remoting.
JMSWireFormat&amp;unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat</
attribute>
 </delegate-config>
 <binding port="4557" />
 <!-- Can also be 4657, 4757, 4857 -->
 </service-config>
</server>
<!-- ********************************************************** -->
<!-- * ports-02 * -->
<!-- ********************************************************** -->
<server name="ports-02">
 <!-- EJB3 Remoting Connector ejb3.deployer/META-INF/jboss-service.xml -->
 <service-config
name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerLocator">socket://${jboss.bind.address}:4073</attribute>
 </delegate-config>
 <binding port="4073" />
 </service-config>
 <!-- Can also be 4073, 4173, 4273 -->
 <!-- ********************* jboss-service.xml ****************** -->
 <service-config name="jboss:service=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" hostName="BindAddress">
 <attribute name="RmiPort">1298</attribute>
 <!-- Can also be 1298, 1398, 1498 -->
 </delegate-config>
 <binding port="1299" host="${jboss.bind.address}" />
 <!-- Can also be 1299, 1399, 1499 -->
 </service-config>
 <service-config name="jboss:service=WebService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="8283" />
 <!-- Can also be 8283, 8383, 8483 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=jrmp"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="4644" />
 <!-- Can also be 4644, 4744, 4844 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=pooled"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="4645" />
 <!-- Can also be 4645, 4745, 4845 -->
 </service-config>
 <!-- ********************* cluster-service.xml **************** -->
 <service-config name="jboss:service=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" hostName="BindAddress">
 <attribute name="RmiPort">1301</attribute>
 <!-- Can also be 1301, 1401, 1501 -->
 </delegate-config>
 <binding port="1300" host="${jboss.bind.address}" />
 <!-- Can also be 1300, 1400, 1500 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=jrmpha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="4644" />
 <!-- Can also be 4644, 4744, 4844 -->
 </service-config>
 <service-config name="jboss:service=invoker,type=pooledha"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="4646" />
 <!-- Can also be 4646, 4746, 4846 -->
 </service-config>
 <!-- ********************* iiop-service.xml ****************** -->
 <service-config name="jboss:service=CorbaORB"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="3728" />
 <!-- Can also be 3728, 3828, 3928 -->
 </service-config>
 <!-- ********************* jmx-rmi-adaptor.sar **************** -->
 <service-config name="jboss.jmx:type=Connector,name=RMI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="RMIObjectPort" />
 <binding port="19201" />
 <!-- Can also be 19201, 19301, 19401 -->
 </service-config>
 <!-- ********************* snmp-adaptor.sar ****************** -->
 <service-config name="jboss.jmx:name=SnmpAgent,service=trapd,type=logger"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="1362" />
 <!-- Can also be 1362, 1462, 1562 -->
 </service-config>
 <service-config name="jboss.jmx:name=SnmpAgent,service=snmp,type=adaptor"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="Port" />
 <binding port="1361" />
 <!-- Can also be 1361, 1461, 1561 -->
 </service-config>
 <!-- ********************* jbossmq-service.xml **************** -->
 <!-- JMS related services -->
 <service-config name="jboss.mq:service=InvocationLayer,type=UIL2"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="ServerBindPort" />
 <binding port="8293" />
 <!-- Can also be 8293, 8393, 8493 -->
 </service-config>
 <!-- ********************* jbossmq-httpil.sar **************** -->
 <service-config name="jboss.mq:service=InvocationLayer,type=HTTP"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="URLPort" />
 <binding port="8280" />
 <!-- Can be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* hajndi-jms-ds.xml **************** -->
 <!-- The JMS provider loader -->
 <service-config
name="jboss.mq:service=JMSProviderLoader,name=HAJNDIJMSProvider"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <!--
MAKE SURE java.naming.provider.url
PORT IS SAME AS HA-JNDI ABOVE !!!
-->
 <delegate-config>
 <attribute name="Properties">
 
<![CDATA[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}:1300 <!-- Can also be
1300, 1400, 1500 -->
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>
 </delegate-config>
 <!-- NOTE: YOU MUST ADD THIS ELEMENT, BUT THE VALUE DOESN'T MATTER
BE SURE THE CORRECT VALUE IS IN java.naming.provider.url ABOVE -->
 <binding port="1300" />
 <!-- Can also be 1300, 1400, 1500 -->
 </service-config>
 <!-- **************** http-invoker.sar & httpha-invoker.sar***************
-->
 <!-- EJBInvoker -->
 <service-config name="jboss:service=invoker,type=http"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/EJBInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8280" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- JMXInvoker -->
 <service-config name="jboss:service=invoker,type=http,target=Naming"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/JMXInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8280" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- readonly JMXInvoker -->
 <service-config
name="jboss:service=invoker,type=http,target=Naming,readonly=true"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/readonly/JMXInvokerServlet</attribute>
 </delegate-config>
 <!--
MUST BE THE SAME AS
TOMCAT HTTP CONNECTOR BELOW !!!
-->
 <binding port="8180" />
 <!-- Can be also 8280, 8380, 8480 -->
 </service-config>
 <!-- **************** httpha-invoker.sar*************** -->
 <!-- EJBInvokerHA -->
 <service-config name="jboss:service=invoker,type=httpHA"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/EJBInvokerHAServlet</attribute>
 </delegate-config>
 <binding port="8280" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- JMXInvokerHA -->
 <service-config name="jboss:service=invoker,type=http,target=HAJNDI"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerURLSuffix">:${port}/invoker/JMXInvokerHAServlet</attribute>
 </delegate-config>
 <binding port="8280" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* jboss-ws4ee.sar **************** -->
 <!-- Web Service related services -->
 <service-config name="jboss.ws4ee:service=AxisService"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config portName="WebServicePort" hostName="WebServiceHost" />
 <binding port="8280" host="${jboss.bind.address}" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* tomcat ********************** -->
 <service-config name="jboss.web:service=WebServer"
delegateClass="org.jboss.services.binding.XSLTFileDelegate">
 <delegate-config>
 <xslt-config configName="ConfigFile">
 <![CDATA[<xsl:stylesheet
xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>
 <xsl:output method="xml" />
 <xsl:param name="port"/>
 <xsl:variable name="portAJP" select="$port - 71"/>
 <xsl:variable name="portHttps" select="$port + 363"/>
 <xsl:template match="/">
 <xsl:apply-templates/>
 </xsl:template>
 <xsl:template match = "Connector">
 <Connector>
 <xsl:for-each select="@*">
 <xsl:choose>
 <xsl:when test="(name() = 'port' and . = '8080')">
 <xsl:attribute name="port">
 <xsl:value-of select="$port" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'port' and . = '8009')">
 <xsl:attribute name="port">
 <xsl:value-of select="$portAJP" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'redirectPort')">
 <xsl:attribute name="redirectPort">
 <xsl:value-of select="$portHttps" />
 </xsl:attribute>
 </xsl:when>
 <xsl:when test="(name() = 'port' and . = '8443')">
 <xsl:attribute name="port">
 <xsl:value-of select="$portHttps" />
 </xsl:attribute>
 </xsl:when>
 <xsl:otherwise>
 <xsl:attribute name="{name()}">
 <xsl:value-of select="." />
 </xsl:attribute>
 </xsl:otherwise>
 </xsl:choose>
 </xsl:for-each>
 <xsl:apply-templates/>
 </Connector>
 </xsl:template>
 <xsl:template match="*|@*">;;
<xsl:copy>
 <xsl:apply-templates select="@*|node()"/>
 </xsl:copy>
 </xsl:template>
 </xsl:stylesheet>]]>
 </xslt-config>
 </delegate-config>
 <binding port="8280" />
 <!-- Can also be 8280, 8380, 8480 -->
 </service-config>
 <!-- ********************* jboss messaging ********************** -->
 <service-config name="jboss.messaging:service=Connector,transport=socket"
delegateClass="org.jboss.services.binding.AttributeMappingDelegate">
 <delegate-config>
 <attribute
name="InvokerLocator">socket://${jboss.bind.address}:4657/?dataType=jms&amp;
serializationtype=jms&amp;timeout=0&amp;leasePeriod=20000&amp;socket.
check_connection=false&amp;marshaller=org.jboss.jms.server.remoting.
JMSWireFormat&amp;unmarshaller=org.jboss.jms.server.remoting.JMSWireFormat</
attribute>
 </delegate-config>
 <binding port="4657" />
 <!-- Can also be 4657, 4757, 4857 -->
 </service-config>
</server>
</service-bindings>

As you can see in comment lines all ports MUST be incremented with 100. It is only trick in this file.

3. Now we should change <your_jboss_dir>/server/<jboss_node>/conf/jboss-service.xml. Uncomment follow block:

<mbean code="org.jboss.services.binding.ServiceBindingManager"
 name="jboss.system:service=ServiceBindingManager">
 <attribute name="ServerName">ports-default</attribute>
 <attribute name="StoreURL">${jboss.home.url}/bindings/binding.xml</attribute>
 <attribute name="StoreFactoryClassName">
 org.jboss.services.binding.XMLServicesStoreFactory
 </attribute>
 </mbean>

Note:

If you have problem with already using bindg port, you need to change one line in: <your_jboss_dir>/server/<jboss_node>/conf/jboss-service.xml

<!-- The Connector is the core component of the remoting server service. -->
<!-- It binds the remoting invoker (transport protocol, callback configuration,
-->
<!-- data marshalling, etc.) with the invocation handlers. -->
<mbean code="org.jboss.remoting.transport.Connector"
 name="jboss.remoting:service=Connector,transport=socket"
 display-name="Socket transport Connector">
<!-- Can either just specify the InvokerLocator attribute and not the
invoker element in the -->
 <!-- Configuration attribute, or do the full invoker configuration in the in
invoker element -->
 <!-- of the Configuration attribute. -->
<!-- Remember that if you do use more than one param on the uri, will have
to include as a CDATA, -->
 <!-- otherwise, parser will complain. -->
 <!-- <attribute
name="InvokerLocator"><![CDATA[socket://${jboss.bind.address}:4446/?datatype=
invocation]]></attribute> -->
<attribute name="Configuration">
 <!-- Using the following <invoker> element instead of the InvokerLocator
above because specific attributes needed. -->
 <!-- If wanted to use any of the parameters below, can just add them as
parameters to the url above if wanted use the InvokerLocator attribute. -->
 <config>
 <!-- Other than transport type and handler, none of these configurations
are required (will just use defaults). -->
 <invoker transport="socket">
 <attribute name="dataType" isParam="true">invocation</attribute>
 <attribute name="marshaller"
isParam="true">org.jboss.invocation.unified.marshall.InvocationMarshaller</
attribute>
 <attribute name="unmarshaller"
isParam="true">org.jboss.invocation.unified.marshall.InvocationUnMarshaller</
attribute>
 <!-- This will be port on which the marshall loader port runs on. 
-->
 <!-- <attribute name="loaderport" isParam="true">4447</attribute>
-->
 <!-- The following are specific to socket invoker -->
 <!-- <attribute name="numAcceptThreads">1</attribute>-->
 <!-- <attribute name="maxPoolSize">303</attribute>-->
 <!-- <attribute name="clientMaxPoolSize"
isParam="true">304</attribute>-->
 <attribute name="socketTimeout" isParam="true">600000</attribute>
 <attribute
name="serverBindAddress">${jboss.bind.address}</attribute>
 <attribute name="serverBindPort">BIND_PORT</attribute>

String BIND_PORT change with accompanying value: 4447, 4547, 4647, ...



Tags: jboss | multiple ports | instances

Hits: 2010 | Read more...


 
Page 2 of 6
«StartPrev123456NextEnd»
IDOBlog - blog for joomla 1.5