How to install more then one instance of JBossWeb
(1) For use more then one instance of JBoss you have to create node directory in your JBOSS_HOME/server directory so it will looks like
-server
-----Default
-----Node1
-----Node2
-----Node3
-----Node4
(2)Copy the apps war on their relative directory's default folder, so now we have directory structure looks like
-Server
-----Default
----------Deploy
---------------foo.war
-----Node1
----------Deploy
---------------bar.war
(Also don't forget to copy their dependent properties and configuration files)
(3) You have to uncomment following lines in Node1/conf/jboss-service.xml
<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>
Replace ports-01 by your server name, here we are using Node1
So in our example these lines will be changed to:
<mbean code="org.jboss.services.binding.ServiceBindingManager"
name="jboss.system:service=ServiceBindingManager">
<attribute name="ServerName">Node1</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>
(4) Now you can start both apps separately by command prompts, type following commands
run.bat :- for default instance and
run.bat -c Node1:- for Node1
(5) But still you will get JVM_BIND address exception, for handle this exception you have to change in following files:-
(a) Node1/conf/jboss-service.xml
<mbean code="org.jboss.web.WebService"
name="jboss:service=WebService">
<attribute name="Port">8083</attribute>
.......
Change port 8083 as any ports that is not in use, simply put +100 in every port
For example change 8083 as 8183
<mbean code="org.jboss.web.WebService"
name="jboss:service=WebService">
<attribute name="Port">8183</attribute>
……..
Same we will change port 1099 as 1199, port 1098 as 1198, port 4444 as 4544, and port 4445 as 4545
<attribute name="Port">1199</attribute>
<!-- The bootstrap JNP server bind address. This also sets the default
RMI service bind address. Empty == all addresses
-->
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<!-- The port of the RMI naming service, 0 == anonymous -->
<attribute name="RmiPort">1198</attribute>
<!-- RMI/JRMP invoker -->
<mbean code="org.jboss.invocation.jrmp.server.JRMPInvoker"
name="jboss:service=invoker,type=jrmp">
<attribute name="RMIObjectPort">4544</attribute>
.....
<attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
<attribute name="ServerBindPort">4545</attribute>
(b) Node1/deploy/jbossweb.sar/server.xml
Change port 8080 as port you wants we are using 8180 in our example Also change 8009 as 8109,
<!-- A HTTP/1.1 Connector on port 8180 -->
<Connector protocol="HTTP/1.1" port="8180" address="${jboss.bind.address}"
redirectPort="8443" xpoweredBy="true"/>
<!-- A AJP 1.3 Connector on port 8109 -->
<Connector protocol="AJP/1.3" port="8109" address="${jboss.bind.address}"
redirectPort="443" />
It works here hope same for you.
(6) Add more then one JBoss instance to windows service
We have to create separate service.bat and .log files for Node1 in JBOSS_HOME/bin folder
In our example we created as service-Node1.bat
Just copy service.bat and rename it as service-Node1.bat
We have to do few changes in service-Node1.bat
See below the changes:
(a)Change service as service-Node1 in following lines, as we did
echo Usage: service-Node1 install^|uninstall^|start^|stop^|restart^|signal
echo Usage: service-Node1 signal <0...9>
(b) Change JBWS1SVC as JBWS1SVCFOO at below places
:cmdInstall
jbosssvc.exe -iwdc JBWS1SVCFOO "%DIRNAME%”........
:cmdUninstall
jbosssvc.exe -u JBWS1SVCFOO
:cmdSignal
jbosssvc.exe -k%2 JBWS1SVCFOO
(c) Now we change start, stop and shutdown parameter in following manners:
:cmdStart
call run.bat -c Node1 >run_Node.log
goto cmdEnd
:cmdStop
call shutdown -S -s localhost:1198>shutdown_Node1.log
goto cmdEnd
:cmdRestart
call shutdown -S -s localhost:1198>>shutdown_Node1.log
call run.bat -c Node1>>run_Node1.log
goto cmdEnd
Look carefully we rename run.log and and shutdown.log as run_Node1.log and shutdown_Node1.log
Also in shutdown parameter we gave jnp port address 1198 that we used in Node1/conf/jboss-service.xml
<attribute name="BindAddress">${jboss.bind.address}</attribute>
<!-- The port of the RMI naming service, 0 == anonymous -->
<attribute name="RmiPort">1198</attribute>
Now you are ready to install JBoss as Windows service
Run on your command prompt following commands for install JBoss to Windows services:-
service install JBWS1SVC :- this command will install default JBossWeb service, and
service-Node1 install JBWS1SVCFOO :- it will install your Node1 service.
Hope it will helpful for you
No comments:
Post a Comment