10.5. Services Binding Management
With all of the independently deployed services available in JBoss, running multiple instances on a given machine can be a tedious exercise in configuration file editing to resolve port conflicts. The binding service allows you centrally configure the ports for multiple JBoss instances. After the service is normally loaded by JBoss, the ServiceConfigurator
queries the service binding manager to apply any overrides that may exist for the service. The service binding manager is configured in conf/jboss-service.xml
. The set of configurable attributes it supports include:
-
ServerName : This is the name of the server configuration this JBoss instance is associated with. The binding manager will apply the overrides defined for the named configuration.
-
StoreFactoryClassName : This is the name of the class that implements the
ServicesStoreFactory
interface. You may provide your own implementation, or use the default XML based storeorg.jboss.services.binding.XMLServicesStoreFactory
. The factory provides aServicesStore
instance responsible for providing the names configuration sets. -
StoreURL : This is the URL of the configuration store contents, which is passed to the
ServicesStore
instance to load the server configuration sets from. For the XML store, this is a simple service binding file.
The following is a sample service binding manager configuration that uses the ports-01
configuration from the sample-bindings.xml
file provided in the JBoss examples directory.
<mbean code="org.jboss.services.binding.ServiceBindingManager" name="jboss.system:service=ServiceBindingManager"> <attribute name="ServerName">ports-01</attribute> <attribute name="StoreURL"> ../docs/examples/binding-manager/sample-bindings.xml </attribute> <attribute name="StoreFactoryClassName"> org.jboss.services.binding.XMLServicesStoreFactory </attribute> </mbean>
The structure of the binding file is shown in Figure 10.1, “The binding service file structure”.

Figure 10.1. The binding service file structure
The elements are:
-
service-bindings : The root element of the configuration file. It contains one or more server elements.
-
server : This is the base of a JBoss server instance configuration. It has a required
name
attribute that defines the JBoss instance name to which it applies. This is the name that correlates with theServiceBindingManager
ServerName
attribute value. The server element content consists of one or moreservice-config
elements. -
service-config : This element represents a configuration override for an MBean service. It has a required name attribute that is the JMX
ObjectName
string of the MBean service the configuration applies to. It also has a requireddelegateClass
name attribute that specifies the class name of theServicesConfigDelegate
implementation that knows how to handle bindings for the target service. Its contents consists of an optionaldelegate-config
element and one or more binding elements. -
binding : A
binding
element specifies a named port and address pair. It has an optionalname
that can be used to provide multiple binding for a service. An example would be multiple virtual hosts for a web container. The port and address are specified via the optionalport
andhost
attributes respectively. If the port is not specified it defaults to 0 meaning choose an anonymous port. If the host is not specified it defaults to null meaning any address. -
delegate-config : The
delegate-config
element is an arbitrary XML fragment for use by theServicesConfigDelegate
implementation. ThehostName
andportName
attributes only apply to theAttributeMappingDelegate
of the example and are there to prevent DTD aware editors from complaining about their existence in theAttributeMappingDelegate
configurations. Generally both the attributes and content of thedelegate-config
are arbitrary, but there is no way to specify and a element can have any number of attributes with a DTD.
The three ServicesConfigDelegate
implementations are AttributeMappingDelegate
, XSLTConfigDelegate
, andXSLTFileDelegate
.
10.5.1. AttributeMappingDelegate
The AttributeMappingDelegate
class is an implementation of the ServicesConfigDelegate
that expects adelegate-config
element of the form:
<delegate-config portName="portAttrName" hostName="hostAttrName"> <attribute name="someAttrName">someHostPortExpr</attribute> <!-- ... --> </delegate-config>
The portAttrName
is the attribute name of the MBean service to which the binding port value should be applied, and the hostAttrName
is the attribute name of the MBean service to which the binding host value should be applied. If the portName
attribute is not specified then the binding port is not applied. Likewise, if the hostName
attribute is not specified then the binding host is not applied. The optional attribute element(s) specify arbitrary MBean attribute names whose values are a function of the host and/or port settings. Any reference to ${host}
in the attribute content is replaced with the host binding and any${port}
reference is replaced with the port binding. The portName
, hostName
attribute values and attribute element content may reference system properties using the ${x}
syntax that is supported by the JBoss services descriptor.
The sample listing illustrates the usage of AttributeMappingDelegate
.
<service-config name="jboss:service=Naming" delegateClass="org.jboss.services.binding.AttributeMappingDelegate"> <delegate-config portName="Port"/> <binding port="1099" /> </service-config>
Here the jboss:service=Naming
MBean service has its Port
attribute value overridden to 1099. The corresponding setting from the jboss1 server configuration overrides the port to 1199.
10.5.2. XSLTConfigDelegate
The XSLTConfigDelegate
class is an implementation of the ServicesConfigDelegate
that expects adelegate-config
element of the form:
<delegate-config> <xslt-config configName="ConfigurationElement"><![CDATA[ Any XSL document contents... ]]> </xslt-config> <xslt-param name="param-name">param-value</xslt-param> <!-- ... --> </delegate-config>
The xslt-config
child element content specifies an arbitrary XSL script fragment that is to be applied to the MBean service attribute named by the configName
attribute. The named attribute must be of typeorg.w3c.dom.Element
. The optional xslt-param
elements specify XSL script parameter values for parameters used in the script. There are two XSL parameters defined by default called host
and port
, and their values are set to the configuration host and port bindings.
The XSLTConfigDelegate
is used to transform services whose port/interface
configuration is specified using a nested XML fragment. The following example maps the port number on hypersonic datasource:
<service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS" delegateClass="org.jboss.services.binding.XSLTConfigDelegate"> <delegate-config> <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[ <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'> <xsl:output method="xml" /> <xsl:param name="host"/> <xsl:param name="port"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="config-property[@name='ConnectionURL']"> <config-property type="java.lang.String" name="ConnectionURL"> jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/> </config-property> </xsl:template> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> ]]> </xslt-config> </delegate-config> <binding host="localhost" port="1901"/> </service-config>
10.5.2. XSLTConfigDelegate
The XSLTConfigDelegate
class is an implementation of the ServicesConfigDelegate
that expects adelegate-config
element of the form:
<delegate-config> <xslt-config configName="ConfigurationElement"><![CDATA[ Any XSL document contents... ]]> </xslt-config> <xslt-param name="param-name">param-value</xslt-param> <!-- ... --> </delegate-config>
The xslt-config
child element content specifies an arbitrary XSL script fragment that is to be applied to the MBean service attribute named by the configName
attribute. The named attribute must be of typeorg.w3c.dom.Element
. The optional xslt-param
elements specify XSL script parameter values for parameters used in the script. There are two XSL parameters defined by default called host
and port
, and their values are set to the configuration host and port bindings.
The XSLTConfigDelegate
is used to transform services whose port/interface
configuration is specified using a nested XML fragment. The following example maps the port number on hypersonic datasource:
<service-config name="jboss.jca:service=ManagedConnectionFactory,name=DefaultDS" delegateClass="org.jboss.services.binding.XSLTConfigDelegate"> <delegate-config> <xslt-config configName="ManagedConnectionFactoryProperties"><![CDATA[ <xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'> <xsl:output method="xml" /> <xsl:param name="host"/> <xsl:param name="port"/> <xsl:template match="/"> <xsl:apply-templates/> </xsl:template> <xsl:template match="config-property[@name='ConnectionURL']"> <config-property type="java.lang.String" name="ConnectionURL"> jdbc:hsqldb:hsql://<xsl:value-of select='$host'/>:<xsl:value-of select='$port'/> </config-property> </xsl:template> <xsl:template match="*|@*"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> ]]> </xslt-config> </delegate-config> <binding host="localhost" port="1901"/> </service-config>
10.5.3. XSLTFileDelegate
The XSLTFileDelegate
class works similarly to the XSLTConfigDelegate
except that instead of transforming an embedded XML fragment, the XSLT script transforms a file read in from the file system. Thedelegate-config
takes exactly the same form:
<delegate-config> <xslt-config configName="ConfigurationElement"><![CDATA[ Any XSL document contents... ]]> </xslt-config> <xslt-param name="param-name">param-value</xslt-param> <!-- ... --> </delegate-config>
The xslt-config
child element content specifies an arbitrary XSL script fragment that is to be applied to the MBean service attribute named by the configName
attribute. The named attribute must be a String value corresponding to an XML file that will be transformed. The optional xslt-param
elements specify XSL script parameter values for parameters used in the script. There are two XSL parameters defined by default called host
and port
, and their values are set to the configuration host
and port
bindings.
The following example maps the host and port values for the Tomcat connectors:
<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"/> </service-config>
10.5.4. The Sample Bindings File
JBoss ships with service binding configuration file for starting up to three separate JBoss instances on one host. Here we will walk through the steps to bring up the two instances and look at the sample configuration. Start by making two server configuration file sets called jboss0
and jboss1
by running the following command from the book examples directory:
[examples]$ ant -Dchap=misc -Dex=1 run-example
This creates duplicates of the server/production
configuration file sets as server/jboss0
and server/jboss1
, and then replaces the conf/jboss-service.xml
descriptor with one that has the ServiceBindingManager
configuration enabled as follows:
<mbean code="org.jboss.services.binding.ServiceBindingManager" name="jboss.system:service=ServiceBindingManager"> <attribute name="ServerName">${jboss.server.name}</attribute> <attribute name="StoreURL">${jboss.server.base.dir}/misc-ex1-bindings.xml</attribute> <attribute name="StoreFactoryClassName"> org.jboss.services.binding.XMLServicesStoreFactory </attribute> </mbean>
Here the configuration name is ${jboss.server.name}
. JBoss will replace that with name of the actual JBoss server configuration that we pass to the run script with the -c
option. That will be either jboss0
or jboss1
, depending on which configuration is being run. The binding manager will find the corresponding server configuration section from the misc-ex1-bindings.xml
and apply the configured overrides. The jboss0
configuration uses the default settings for the ports, while the jboss1
configuration adds 100 to each port number.
To test the sample configuration, start two JBoss instances using the jboss0
and jboss1
configuration file sets created previously. You can observe that the port numbers in the console log are different for thejboss1
server. To test out that both instances work correctly, try accessing the web server of the first JBoss on port 8080 and then try the second JBoss instance on port 8180.
发表评论
-
jboss twiddle命令例子
2012-03-19 15:15 835twiddle.sh -uadmin -p12345678 g ... -
JBoss EAP 使用 Binding Manager
2012-03-14 10:56 881For JBoss 4.3.x: 1. edit JB ... -
JBoss Howto - Configure Ports
2012-02-02 16:34 861https://community.jboss.org/doc ... -
JBoss - AS 5 ServiceBindingManager
2012-02-02 16:33 1086https://community.jboss.org/doc ... -
JBoss - Configuring Multiple JBoss Instances On One Machine
2012-02-02 15:04 901https://community.jboss.org/doc ... -
JBoss Howto - EAP 5.1.1 Native libaray Installation
2011-11-23 15:17 673Installation: unpack native pa ...
相关推荐
1. jboss各主要版本特性 3 1.1. jboss4特性 3 1.2. jboss5特性 5 1.3. jboss6特性 6 1.4. jboss7特性 7 2. 为什么JBoss AS7 这么快 8 3. JBoss AS7中的新概念-域 10 ...4.4.5.4. Web services 89 4.4.5.4.1. 参考 90
以上只是Java和J2EE领域的一小部分知识,实际的学习过程中还会涉及到许多其他概念和技术,如JNDI(Java Naming and Directory Interface)、JAXB(Java Architecture for XML Binding)、JMX(Java Management ...
- **WebLogic、JBoss**:熟悉WebLogic、JBoss等应用服务器,掌握其安装、配置及使用方法。 - **集群与负载均衡**:理解集群和负载均衡的基本原理,学会配置应用服务器以支持高可用性和负载均衡。 #### 十八、面向切...
JAX-WS(Java API for XML Web Services)是Java中用于构建Web服务的标准,而JAXB(Java Architecture for XML Binding)用于XML和Java对象之间的数据绑定。 7. **数据库连接(JDBC)**:Java Database ...
1.版本:matlab2014/2019a/2024a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
MMC整流器技术解析:基于Matlab的双闭环控制策略与环流抑制性能研究,Matlab下的MMC整流器技术文档:18个子模块,双闭环控制稳定直流电压,环流抑制与最近电平逼近调制,优化桥臂电流波形,高效并网运行。,MMC整流器(Matlab),技术文档 1.MMC工作在整流侧,子模块个数N=18,直流侧电压Udc=25.2kV,交流侧电压6.6kV 2.控制器采用双闭环控制,外环控制直流电压,采用PI调节器,电流内环采用PI+前馈解耦; 3.环流抑制采用PI控制,能够抑制环流二倍频分量; 4.采用最近电平逼近调制(NLM), 5.均压排序:电容电压排序采用冒泡排序,判断桥臂电流方向确定投入切除; 结果: 1.输出的直流电压能够稳定在25.2kV; 2.有功功率,无功功率稳态时波形稳定,有功功率为3.2MW,无功稳定在0Var; 3.网侧电压电流波形均为对称的三相电压和三相电流波形,网侧电流THD=1.47%<2%,符合并网要求; 4.环流抑制后桥臂电流的波形得到改善,桥臂电流THD由9.57%降至1.93%,环流波形也可以看到得到抑制; 5.电容电压能够稳定变化 ,工作点关键词:MMC
Boost二级升压光伏并网结构的Simulink建模与MPPT最大功率点追踪:基于功率反馈的扰动观察法调整电压方向研究,Boost二级升压光伏并网结构的Simulink建模与MPPT最大功率点追踪:基于功率反馈的扰动观察法调整电压方向研究,Boost二级升压光伏并网结构,Simulink建模,MPPT最大功率点追踪,扰动观察法采用功率反馈方式,若ΔP>0,说明电压调整的方向正确,可以继续按原方向进行“干扰”;若ΔP<0,说明电压调整的方向错误,需要对“干扰”的方向进行改变。 ,Boost升压;光伏并网结构;Simulink建模;MPPT最大功率点追踪;扰动观察法;功率反馈;电压调整方向。,光伏并网结构中Boost升压MPPT控制策略的Simulink建模与功率反馈扰动观察法
STM32F103C8T6 USB寄存器开发详解(12)-键盘设备
科技活动人员数专指直接从事科技活动以及专门从事科技活动管理和为科技活动提供直接服务的人员数量
Matlab Simulink仿真探究Flyback反激式开关电源性能表现与优化策略,Matlab Simulink仿真探究Flyback反激式开关电源的工作机制,Matlab Simulimk仿真,Flyback反激式开关电源仿真 ,Matlab; Simulink仿真; Flyback反激式; 开关电源仿真,Matlab Simulink在Flyback反激式开关电源仿真中的应用
基于Comsol的埋地电缆电磁加热计算模型:深度解析温度场与电磁场分布学习资料与服务,COMSOL埋地电缆电磁加热计算模型:温度场与电磁场分布的解析与学习资源,comsol 埋地电缆电磁加热计算模型,可以得到埋地电缆温度场及电磁场分布,提供学习资料和服务, ,comsol;埋地电缆电磁加热计算模型;温度场分布;电磁场分布;学习资料;服务,Comsol埋地电缆电磁加热模型:温度场与电磁场分布学习资料及服务
1、文件内容:ibus-table-chinese-yong-1.4.6-3.el7.rpm以及相关依赖 2、文件形式:tar.gz压缩包 3、安装指令: #Step1、解压 tar -zxvf /mnt/data/output/ibus-table-chinese-yong-1.4.6-3.el7.tar.gz #Step2、进入解压后的目录,执行安装 sudo rpm -ivh *.rpm 4、更多资源/技术支持:公众号禅静编程坊
基于51单片机protues仿真的汽车智能灯光控制系统设计(仿真图、源代码) 一、设计项目 根据本次设计的要求,设计出一款基于51单片机的自动切换远近光灯的设计。 技术条件与说明: 1. 设计硬件部分,中央处理器采用了STC89C51RC单片机; 2. 使用两个灯珠代表远近光灯,感光部分采用了光敏电阻,因为光敏电阻输出的是电压模拟信号,单片机不能直接处理模拟信号,所以经过ADC0832进行转化成数字信号; 3. 显示部分采用了LCD1602液晶,还增加按键部分电路,可以选择手自动切换远近光灯; 4. 用超声模块进行检测距离;
altermanager的企业微信告警服务
MyAgent测试版本在线下载
Comsol技术:可调BIC应用的二氧化钒VO2材料探索,Comsol模拟二氧化钒VO2的可调BIC特性研究,Comsol二氧化钒VO2可调BIC。 ,Comsol; 二氧化钒VO2; 可调BIC,Comsol二氧化钒VO2材料:可调BIC技术的关键应用
C++学生成绩管理系统源码
基于Matlab与Cplex的激励型需求响应模式:负荷转移与电价响应的差异化目标函数解析,基于Matlab与CPLEX的激励型需求响应负荷转移策略探索,激励型需求响应 matlab +cplex 激励型需求响应采用激励型需求响应方式对负荷进行转移,和电价响应模式不同,具体的目标函数如下 ,激励型需求响应; matlab + cplex; 负荷转移; 目标函数。,Matlab与Cplex结合的激励型需求响应模型及其负荷转移策略
scratch介绍(scratch说明).zip
内容概要:本文全面介绍了深度学习模型的概念、工作机制和发展历程,详细探讨了神经网络的构建和训练过程,包括反向传播算法和梯度下降方法。文中还列举了深度学习在图像识别、自然语言处理、医疗和金融等多个领域的应用实例,并讨论了当前面临的挑战,如数据依赖、计算资源需求、可解释性和对抗攻击等问题。最后,文章展望了未来的发展趋势,如与量子计算和区块链的融合,以及在更多领域的应用前景。 适合人群:对该领域有兴趣的技术人员、研究人员和学者,尤其适合那些希望深入了解深度学习原理和技术细节的读者。 使用场景及目标:①理解深度学习模型的基本原理和结构;②了解深度学习模型的具体应用案例;③掌握应对当前技术挑战的方向。 阅读建议:文章内容详尽丰富,读者应在阅读过程中注意理解各个关键技术的概念和原理,尤其是神经网络的构成及训练过程。同时也建议对比不同模型的特点及其在具体应用中的表现。