敬的世界

常用链接

统计

最新评论

Running multiple instances of JBoss on the same server

Sometimes it is useful to run more than one instance of JBoss on the same server. Other instances can be set up for development, testing or for quality assurance, etc.

ConfiguringMultipleJBossInstancesOnOneMachine on the JBoss wiki has the basic info but does not seem to be up to date for the newer servers (4.2.x+).

Before setting up another instance, other outside resources may also have to be 'cloned' if it is possible that they may conflict, such as setting up another instance of a database with a separate connection url and matching datasource for JBoss.

The basic steps are as follows:

1) Add port-bindings.xml file for binding service port definitions. This file has the same content as jboss sample-bindings.xml available from the wiki.

Rename to "port-bindings.xml" and save to $JBOSS_HOME/server directory.

2) The binding service manager needs to be enabled in conf/jboss-service.xml for instances that are not using the default ports.

Remove the comments to enable the "ServiceBindingManager" mbean and modify the content as below:

"ServerName" attribute should reference a port configuration in port-bindings.xml and "StoreURL" should point to the port-bindings.xml file


<mbean code="org.jboss.services.binding.ServiceBindingManager"
     name="jboss.system:service=ServiceBindingManager">
     <attribute name="ServerName">ports-01</attribute>
     <attribute name="StoreURL">file:../server/port-bindings.xml</attribute>
     <attribute name="StoreFactoryClassName">
       org.jboss.services.binding.XMLServicesStoreFactory
     </attribute>
</mbean>

the next few changes are not mentioned in jboss wiki documentation

3) Under "Socket transport Connector", in the "Configuration" section, serverBindPort must be changed to another value or it will conflict with the default(4446)

<mbean code="org.jboss.remoting.transport.Connector"
          name="jboss.remoting:service=Connector,transport=socket"
          display-name="Socket transport Connector">
...

<attribute name="Configuration">

...

       <attribute name="serverBindPort">4446</attribute>

4) And in
/deploy/ejb3.deployer/META-INF/jboss-service.xml,
for the remoting.transport.Connector mbean, port 3873 must be changed to another value or it will conflict with the default.

    <mbean code="org.jboss.remoting.transport.Connector"
          name="jboss.remoting:type=Connector,name=DefaultEjb3Connector,handler=ejb3">

...     

        <attribute name="InvokerLocator">socket://${jboss.bind.address}:3873</attribute>

 

5) Also, any startup scripts in $JBOSS_HOME/bin may have to be cloned with different debug ports if remote debugging is enabled.

In summary the directory structure for setting up two other instances would be something like the below with added port-bindings.xml and modifications in the filenames in bold.



$JBOSS_HOME/server/port-bindings.xml
$JBOSS_HOME/server/default
$JBOSS_HOME/server/node1
$JBOSS_HOME/server/node1/conf/jboss-service.xml
$JBOSS_HOME/server/node1/deploy/ejb3.deployer/META-INF/jboss-service.xml
$JBOSS_HOME/server/node2
$JBOSS_HOME/server/node2/conf/jboss-service.xml
$JBOSS_HOME/server/node2/deploy/ejb3.deployer/META-INF/jboss-service.xml

Separate instances are run with "run -c node1" etc. and applications accessed with urls like:

http://localhost:8080/myapp/
http://localhost:8180/myapp/
http://localhost:8280/myapp/

posted on 2008-11-17 04:26 picture talk 阅读(280) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: