Consideration:
1.
Create Two Windows Service
2.
Deployment of Two different applications in one
Jboss App Server.
3.
Run one application on windows service 1 and Run
Second application windows service 2
As per my previous post we are able to create one Windows service,
now I am trying to create two or multiple windows services.
When trying to create multiple services be careful for following
points.
1.
Create two separate bat files like serviceAS1.bat , serviceAS2.bat
, serviceAS3.bat .. etc
2.
Create two separate deployment directories
inside C:\jboss-as-7.1.1.Final\
3.
Name of services name should be different like
For Service 1
set
SVCNAME=JBOSSASONE
set
SVCDISP= JBOSSASONE
set
SVCDESC=JBoss Application Server 7.1.1
Final GA/Platform: Windows x64 ONE
For Service 2
set
SVCNAME=JBOSSASTWO
set
SVCDISP= JBOSSASTWO
set
SVCDESC=JBoss Application Server 7.1.1
Final GA/Platform: Windows x64 TWO
4.
Give separate name to all the log entries in
service.bat file e.g
For Service 1 -> run1.log, shutdow1.log
For Service 2 -> run2.log, shutdown2.log
5.
Remove all lock entry in start service and stop
service code from service.bat file. (We can keep as it )
I have created below 2 different service.bat files,
refer below file
ServiceAS1.bat
@echo off
REM JBoss, the OpenSource webOS
REM
REM Distributable under LGPL license.
REM See terms of license at gnu.org.
REM
REM
-------------------------------------------------------------------------
REM JBoss Service Script for Windows
REM
-------------------------------------------------------------------------
@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal
set DIRNAME=%CD%
REM
REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated
REM during the build with ant filter.
REM
set SVCNAME=JBOSSASONE
set SVCDISP=JBOSSASONE
set SVCDESC=JBoss Application
Server 7.1.1 Final GA/Platform: Windows x64 ONE
set NOPAUSE=Y
REM Suppress killing service on logoff event
set JAVA_OPTS=-Xrs -Xms1024M
-Xmx1024M
REM Figure out the running mode
if /I "%1" == "install" goto cmdInstall
if /I "%1" == "uninstall" goto cmdUninstall
if /I "%1" == "start" goto cmdStart
if /I "%1" == "stop" goto cmdStop
if /I "%1" == "restart" goto cmdRestart
if /I "%1" == "signal" goto cmdSignal
echo Usage: service install^|uninstall^|start^|stop^|restart^|signal
goto cmdEnd
REM jbosssvc retun values
REM ERR_RET_USAGE 1
REM ERR_RET_VERSION 2
REM ERR_RET_INSTALL 3
REM ERR_RET_REMOVE 4
REM ERR_RET_PARAMS 5
REM ERR_RET_MODE 6
:errExplain
if errorlevel 1 echo Invalid command line parameters
if errorlevel 2 echo Failed installing %SVCDISP%
if errorlevel 4 echo Failed removing %SVCDISP%
if errorlevel 6 echo Unknown service mode for %SVCDISP%
goto cmdEnd
:cmdInstall
jbosssvc.exe -imwdc %SVCNAME%
"%DIRNAME%" "%SVCDISP%" "%SVCDESC%" serviceAS1.bat
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% installed
goto cmdEnd
:cmdUninstall
jbosssvc.exe -u %SVCNAME%
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% removed
goto cmdEnd
:cmdStart
REM Executed on service start
del .r.lock 2>&1 | findstr /C:"being used" > nul
if not errorlevel 1 (
echo Could not continue.
Locking file already in use.
goto cmdEnd
)
jbosssvc.exe -p 1 "Starting %SVCDISP%" > run1.log
call standalone.bat -Djboss.home.dir=C:/jboss-as-7.1.1.Final
-Djboss.server.base.dir=standalone1 --server-config=standalone1.xml >> run1.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run1.log
goto cmdEnd
:cmdStop
REM Executed on service stop
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown1.log
call jboss-cli.bat --connect
controller=127.0.0.1:9999 command=:shutdown >> shutdown1.log
2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown1.log
goto cmdEnd
:cmdRestart
REM Executed manually from command line
REM Note: We can only stop and start
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >>
shutdown1.log
call jboss-cli.bat --connect
controller=127.0.0.1:9999 command=:shutdown >> shutdown1.log
2>&1
:waitRun
REM Delete lock file
del .r.lock > nul 2>&1
REM Wait one second if lock file exist
jbosssvc.exe -s 1
if exist ".r.lock" goto waitRun
echo Y > .r.lock
jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> run1.log
call standalone.bat
-Djboss.home.dir=C:/jboss-as-7.1.1.Final -Djboss.server.base.dir=standalone1
--server-config=standalone1.xml
>> run1.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run1.log
del .r.lock
goto cmdEnd
:cmdSignal
REM Send signal to the service.
REM Requires jbosssch.dll to be loaded in JVM
@if not ""%2"" == """" goto
execSignal
echo Missing signal parameter.
echo Usage: service signal [0...9]
goto cmdEnd
:execSignal
jbosssvc.exe -k%2 %SVCNAME%
goto cmdEnd
:cmdEnd
|
Standalone1.xml configuration
for run first Application on http port
<subsystem xmlns="urn:jboss:domain:web:1.1"
default-virtual-server="default-host" native="false">
<connector
name="http" protocol="HTTP/1.1" scheme="http"
socket-binding="http"/>
<virtual-server
name="default-host" enable-welcome-root="true">
<alias
name="localhost"/>
<alias
name="example.com"/>
</virtual-server>
</subsystem>
<interfaces>
<interface
name="management">
<inet-address
value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface
name="public">
<inet-address
value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface
name="unsecure">
<inet-address
value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets"
default-interface="public"
port-offset="${jboss.socket.binding.port-offset:0}">
<socket-binding
name="management-native" interface="management"
port="${jboss.management.native.port:9999}"/>
<socket-binding
name="management-http" interface="management"
port="${jboss.management.http.port:9990}"/>
<socket-binding
name="management-https" interface="management"
port="${jboss.management.https.port:9443}"/>
<socket-binding
name="ajp" port="8009"/>
<socket-binding
name="http" port="8081"/>
<socket-binding
name="https" port="8443"/>
<socket-binding
name="osgi-http" interface="management"
port="8090"/>
<socket-binding name="remoting"
port="4447"/>
<socket-binding
name="txn-recovery-environment" port="4712"/>
<socket-binding
name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost"
port="25"/>
</outbound-socket-binding>
</socket-binding-group>
|
ServiceAS2.bat
@echo off
REM JBoss, the OpenSource webOS
REM
REM Distributable under LGPL license.
REM See terms of license at gnu.org.
REM
REM
-------------------------------------------------------------------------
REM JBoss Service Script for Windows
REM
-------------------------------------------------------------------------
@if not "%ECHO%" == "" echo %ECHO%
@if "%OS%" == "Windows_NT" setlocal
set DIRNAME=%CD%
REM
REM VERSION, VERSION_MAJOR and VERSION_MINOR are populated
REM during the build with ant filter.
REM
set SVCNAME=JBOSSASTWO
set SVCDISP=JBOSSASTWO
set SVCDESC=JBoss Application
Server 7.1.1 Final GA/Platform: Windows x64 TWO
set NOPAUSE=Y
REM Suppress killing service on logoff event
set JAVA_OPTS=-Xrs -Xms1024M
-Xmx1024M
REM Figure out the running mode
if /I "%1" == "install" goto cmdInstall
if /I "%1" == "uninstall" goto cmdUninstall
if /I "%1" == "start" goto cmdStart
if /I "%1" == "stop" goto cmdStop
if /I "%1" == "restart" goto cmdRestart
if /I "%1" == "signal" goto cmdSignal
echo Usage: service install^|uninstall^|start^|stop^|restart^|signal
goto cmdEnd
REM jbosssvc retun values
REM ERR_RET_USAGE 1
REM ERR_RET_VERSION 2
REM ERR_RET_INSTALL 3
REM ERR_RET_REMOVE 4
REM ERR_RET_PARAMS 5
REM ERR_RET_MODE 6
:errExplain
if errorlevel 1 echo Invalid command line parameters
if errorlevel 2 echo Failed installing %SVCDISP%
if errorlevel 4 echo Failed removing %SVCDISP%
if errorlevel 6 echo Unknown service mode for %SVCDISP%
goto cmdEnd
:cmdInstall
jbosssvc.exe -imwdc %SVCNAME%
"%DIRNAME%" "%SVCDISP%" "%SVCDESC%" serviceAS2.bat
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% installed
goto cmdEnd
:cmdUninstall
jbosssvc.exe -u %SVCNAME%
if not errorlevel 0 goto errExplain
echo Service %SVCDISP% removed
goto cmdEnd
:cmdStart
REM Executed on service start
del .r.lock 2>&1 | findstr /C:"being used" > nul
if not errorlevel 1 (
echo Could not continue.
Locking file already in use.
goto cmdEnd
)
jbosssvc.exe -p 1 "Starting %SVCDISP%" > run2.log
call standalone.bat -Djboss.home.dir=C:/jboss-as-7.1.1.Final
-Djboss.server.base.dir=standalone2 --server-config=standalone2.xml >> run2.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run2.log
goto cmdEnd
:cmdStop
REM Executed on service stop
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" > shutdown2.log
call jboss-cli.bat --connect
controller=127.0.0.1:19999 command=:shutdown >> shutdown2.log
2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> shutdown2.log
goto cmdEnd
:cmdRestart
REM Executed manually from command line
REM Note: We can only stop and start
jbosssvc.exe -p 1 "Shutting down %SVCDISP%" >>
shutdown1.log
call jboss-cli.bat --connect
controller=127.0.0.1:19999 command=:shutdown >> shutdown2.log
2>&1
:waitRun
REM Delete lock file
del .r.lock > nul 2>&1
REM Wait one second if lock file exist
jbosssvc.exe -s 1
if exist ".r.lock" goto waitRun
echo Y > .r.lock
jbosssvc.exe -p 1 "Restarting %SVCDISP%" >> run2.log
call standalone.bat
-Djboss.home.dir=C:/jboss-as-7.1.1.Final
-Djboss.server.base.dir=standalone2 -config=standalone2.xml >> run2.log 2>&1
jbosssvc.exe -p 1 "Shutdown %SVCDISP% service" >> run2.log
del .r.lock
goto cmdEnd
:cmdSignal
REM Send signal to the service.
REM Requires jbosssch.dll to be loaded in JVM
@if not ""%2"" == """" goto
execSignal
echo Missing signal parameter.
echo Usage: service signal [0...9]
goto cmdEnd
:execSignal
jbosssvc.exe -k%2 %SVCNAME%
goto cmdEnd
:cmdEnd
|
Configuration of Standalone2.xml to run second Application on http port
<subsystem xmlns="urn:jboss:domain:web:1.1"
default-virtual-server="default-host" native="false">
<connector
name="http" protocol="HTTP/1.1" scheme="http"
socket-binding="http"/>
<virtual-server
name="default-host" enable-welcome-root="true">
<alias
name="localhost"/>
<alias
name="example.com"/>
</virtual-server>
</subsystem>
<interfaces>
<interface
name="management">
<inet-address
value="${jboss.bind.address.management:127.0.0.1}"/>
</interface>
<interface
name="public">
<inet-address
value="${jboss.bind.address:127.0.0.1}"/>
</interface>
<interface
name="unsecure">
<inet-address
value="${jboss.bind.address.unsecure:127.0.0.1}"/>
</interface>
</interfaces>
<socket-binding-group name="standard-sockets"
default-interface="public"
port-offset="${jboss.socket.binding.port-offset:10000}">
<socket-binding
name="management-native" interface="management"
port="${jboss.management.native.port:9999}"/>
<socket-binding
name="management-http" interface="management"
port="${jboss.management.http.port:9990}"/>
<socket-binding
name="management-https" interface="management"
port="${jboss.management.https.port:9443}"/>
<socket-binding
name="ajp" port="8009"/>
<socket-binding
name="http"
port="8081"/>
<socket-binding
name="https"
port="8443"/>
<socket-binding
name="osgi-http" interface="management"
port="8090"/>
<socket-binding name="remoting"
port="4447"/>
<socket-binding
name="txn-recovery-environment" port="4712"/>
<socket-binding
name="txn-status-manager" port="4713"/>
<outbound-socket-binding name="mail-smtp">
<remote-destination host="localhost"
port="25"/>
</outbound-socket-binding>
</socket-binding-group>
|
Installation of Windows Services
C:\jboss-as-7.1.1.Final\bin>serviceAS1.bat
install
Installed JBOSSASONE
Service JBOSSASONE installed
|
C:\jboss-as-7.1.1.Final\bin>serviceAS2.bat
install
Installed JBOSSASTWO
Service JBOSSASTWO installed
|
Consider
for Windows 7
1)
Open Windows Management console using run. Click
on start button, in Run or search text box type service. Now on the top we are
able to service option. Click on in. Or Also we can access service in Windows
Management console by using task manager.
2)
After
windows management console search our service in it and change the startup type Manual to Automatic which would make sure that
whenever you start/bootup your system the JBoss AS 7 services starts up
automatically.
3)
Click on start service, status will change to
started.
4)
To stop the service we have to click on stop link in Windows Management Console
5)
We can stop service using command like
C:\jboss-as-7.1.1.Final\bin>serviceAS1.bat
stop
C:\jboss-as-7.1.1.Final\bin>serviceAS2.bat
stop
6)
r if the server not shutdown or stopped properly
through service then we can execute below command from command prompt to stop
the service.
C:\jboss-as-7.1.1.Final\bin>
jboss-cli.bat --connect controller=127.0.0.1:9999 command=:shutdown;
|
You will get output like as
follows
Shutting down JBOSSASONE
[2013-12-26 17:18:26]
{"outcome" =>
"success"}
Shutdown JBOSSASONE service
[2013-12-26 17:18:28]
|
C:\jboss-as-7.1.1.Final\bin>
jboss-cli.bat --connect controller=127.0.0.1:19999 command=:shutdown;
|
You will get output like as
follows
Shutting down JBOSSASTWO
[2013-12-26 17:20:26]
{"outcome" =>
"success"}
Shutdown JBOSSASTWO service
[2013-12-26 17:20:28]
|
URLs for two Applications
Considering above services
are in running state. How to access these two applications
First Application:
Second Application
Because we have
configured standalone2.xml
<socket-binding-group name="standard-sockets"
default-interface="public"
port-offset="${jboss.socket.binding.port-offset:10000}">
portoffset is 10000 +
localhost http port 8081 = 18081
Configure Second application to HTTPS
port
If we want run second
application on https port then we need to configure standalone2.xml
In https connector as
mentioned in my previous post for configuring http using keytool or
If we have the
trusted key provided by certification authority then we can configure in
connector in standlone2.xml file.
Run the application
on https port
Thanks it works perfectly!!!!!
ReplyDeleteThank you. The above procedure worked very fine for making two instances of Jboss Service. My app deployed and worked very well on the 8080 port. But for the offset port (in my case 8090) the .ear file deployed well but when tried to login(it has login and pwd) it comes up with an error: "IJ000453:Unable to get managed connection for java:jboss/rtesource/jca/JETI/Adapter"
ReplyDeletecheck the datasources configuration in standalone.xml
ReplyDeletenicely presented and documented. I am trying to do the same for EAP6.1 on windows. will it be same procedure ? what are the things I need to keep in mind ?
ReplyDeletecanlı sex hattı
ReplyDeletejigolo arayan bayanlar
DR0DA
sakarya
ReplyDeleteelazığ
sinop
siirt
van
ZDZ270
whatsapp görüntülü show
ReplyDeleteücretli.show
JEG5Q7
AD83D
ReplyDeleteNevşehir Parça Eşya Taşıma
Giresun Evden Eve Nakliyat
Maraş Parça Eşya Taşıma
Antalya Lojistik
Gümüşhane Evden Eve Nakliyat
C4395
ReplyDeleteBurdur Şehirler Arası Nakliyat
Şırnak Evden Eve Nakliyat
Artvin Parça Eşya Taşıma
Kars Parça Eşya Taşıma
Etlik Boya Ustası
Şırnak Parça Eşya Taşıma
Diyarbakır Lojistik
Mardin Parça Eşya Taşıma
Gümüşhane Parça Eşya Taşıma
79640
ReplyDeletePursaklar Fayans Ustası
Trabzon Şehirler Arası Nakliyat
Kırşehir Şehirler Arası Nakliyat
Pancakeswap Güvenilir mi
Çankırı Şehirler Arası Nakliyat
Karaman Evden Eve Nakliyat
Karaman Lojistik
Yenimahalle Boya Ustası
Maraş Şehir İçi Nakliyat
D7038
ReplyDeleteBilecik Evden Eve Nakliyat
Eskişehir Şehirler Arası Nakliyat
Karabük Parça Eşya Taşıma
Manisa Şehir İçi Nakliyat
Osmaniye Evden Eve Nakliyat
Maraş Şehirler Arası Nakliyat
Hatay Şehirler Arası Nakliyat
Bartın Lojistik
İstanbul Parça Eşya Taşıma
30FE0
ReplyDeleteTrabzon Evden Eve Nakliyat
Binance Referans Kodu
Osmaniye Evden Eve Nakliyat
Şırnak Evden Eve Nakliyat
buy sarms
testosterone propionat
buy winstrol stanozolol
order boldenone
Karaman Evden Eve Nakliyat
36D51
ReplyDeleteGölbaşı Parke Ustası
Star Atlas Coin Hangi Borsada
Erzincan Şehirler Arası Nakliyat
Satoshi Coin Hangi Borsada
Ünye Oto Lastik
Şırnak Şehir İçi Nakliyat
Nevşehir Şehir İçi Nakliyat
Binance Güvenilir mi
Çerkezköy Oto Boya
C502B
ReplyDeleteJns Coin Hangi Borsada
Van Şehirler Arası Nakliyat
Malatya Şehir İçi Nakliyat
Çerkezköy Korkuluk
Giresun Parça Eşya Taşıma
Erzincan Lojistik
Yobit Güvenilir mi
Star Atlas Coin Hangi Borsada
Bartın Şehirler Arası Nakliyat
94D9B
ReplyDeleteKarabük Evden Eve Nakliyat
dianabol methandienone
order sarms
Ordu Evden Eve Nakliyat
Elazığ Evden Eve Nakliyat
Silivri Evden Eve Nakliyat
Tekirdağ Cam Balkon
pharmacy steroids for sale
Bartın Evden Eve Nakliyat
8F9FA
ReplyDeletekomisyon indirimi %20
B576A
ReplyDeletereferans kodu
C782E
ReplyDeletebursa bedava sohbet chat odaları
konya ücretsiz sohbet uygulaması
görüntülü sohbet canlı
çorum ücretsiz sohbet uygulaması
yalova sesli sohbet
canlı sohbet bedava
telefonda canlı sohbet
bursa sohbet siteleri
şırnak en iyi ücretsiz sohbet siteleri
9E766
ReplyDeletehakkari canlı sohbet odası
sesli sohbet sitesi
sivas canlı sohbet bedava
ucretsiz sohbet
bingöl görüntülü sohbet yabancı
Ağrı Canlı Sohbet Et
Aydın Sesli Sohbet Sesli Chat
mardin canlı görüntülü sohbet siteleri
van canlı sohbet
79687
ReplyDeleteaydın en iyi sesli sohbet uygulamaları
izmir sesli sohbet mobil
giresun rastgele görüntülü sohbet
izmir sesli mobil sohbet
amasya sesli görüntülü sohbet
giresun canlı sohbet odası
sohbet siteleri
aydın mobil sohbet chat
eskişehir rastgele görüntülü sohbet uygulaması
شركة شفط بيارات twZd9rPw2p
ReplyDelete