以jboss-4.2.3.GA为例:
1.在jboss-4.2.3.GA\server目录下有:default,all,minimal三个文件夹
打开default中conf文件夹jboss-service.xml,搜索“service binding”,这一段代码是注释掉的
<!-- Service Binding -->
<!-- ==================================================================== -->
<!-- Automatically activated when generatting the clustering environment -->
<!-- @TESTSUITE_CLUSTER_CONFIG@ -->
<!--
| Binding service manager for port/host mapping. This is a sample
| config that demonstrates a JBoss instances with a server name 'ports-01'
| loading its bindings from an XML file using the ServicesStoreFactory
| implementation returned by the XMLServicesStoreFactory.
|
| ServerName: The unique name assigned to a JBoss server instance for
| lookup purposes. This allows a single ServicesStore to handle mulitiple
| JBoss servers.
|
| StoreURL: The URL string passed to org.jboss.services.binding.ServicesStore
| during initialization that specifies how to connect to the bindings store.
| StoreFactory: The org.jboss.services.binding.ServicesStoreFactory interface
| implementation to create to obtain the ServicesStore instance.
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">ports-01</attribute>
<attribute name="StoreURL"> ${jboss.home.url}/docs/examples/binding-manager/sample-bindings.xml </attribute>
<attribute name="StoreFactoryClassName">
org.jboss.services.binding.XMLServicesStoreFactory
</attribute>
</mbean>
-->
2.在\docs\examples\binding-manager目录中打开sample-bindings.xml文件,里面有ports-default,ports-01,ports-02,ports-03,分别对应端口号8080,8180,8280,8380,也就是说,可以配置4个不同的端口。
3.现在只需要将server目录中的default复制一份,粘贴到server目录中,重命名为test,将jboss-service.xml中的<attribute name="ServerName">ports-01</attribute>
中的ports-01改为sample-binding.xml中的server的名称(ports-02 or ports-03)。这样就可以了
4.4个实例一般够用了,如果不够,可在sample-binding 中增加组(ports-4)。
5.在window系统中,切换到bin目录,run.bat -c test,启动test实例。