Labels

Saturday, June 16, 2012

Configuring Service Mode for JBoss


Introduction
Following document explain the steps to configure JBoss to run in a service mode. To Proceed with the document one should have the Administration level of knowledge on Windows Environment.
Steps to Configure Service
Prerequisites
App application Installed on windows & configured to run on JBoss version 6.0
Assumption
For Single Server deployed with the name ‘default’ and App.bat file is available under jboss6\bin folder which is previously used to run the application.
For Multiple Server deployed with the name ‘A1’, ‘App2’ and so on.
App1.bat, App2.bat, etc. files are available under jboss6\bin folder which is previously used to run the application.
For single server Setup
Create copy of the <Jboss>\bin\service.bat into another file with name ‘service_App.bat’
Configuration
  1. Edit File service_App.bat & change following Properties.
    1. Search for
      set "SVCNAME=JBAS60SVC"
      Change it to
      set "SVCNAME=App_Jboss"
    2. Search for
      set SVCDISP=JBoss Application Server 6.0
      Change it to
      set SVCDISP=App JBoss Server 6.0
    3. Search for
      set SVCDESC=JBoss Application Server 6.0.0 GA/Platform: Windows %PROCESSOR_ARCHITECTURE%
      Change it to
      set SVCDESC=App JBoss Server 6.0.0 GA/Platform: Windows %PROCESSOR_ARCHITECTURE%
    4. Search for
      jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service.bat
      Change it to
      jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service_App.bat
    5. Search for (this will appear twice)
      call run.bat < .r.lock >> run.log 2>&1
      Change it to (Change both instance)
      call App.bat -c App -b 0.0.0.0 < .r.lock 2>&1
      If the server is running on specific IP then change it with following
      call App.bat -c App -b <IP_ADDRESS> < .r.lock 2>&1
    6. Search for (this will appear twice)
      call shutdown -S < .s.lock >> shutdown.log 2>&1
      Change it to (Change both instance)
      call shutdown --host=127.0.0.1 --port=1090 -S < .s.lock >> shutdown.log 2>&1
      If the server is running on specific IP then change it with following
      call shutdown --host=<IP_ADDRESS> --port=1090 -S < .s.lock >> shutdown.log 2>&1
  2. Edit file App.bat and verify if following properties are set to correct path, if not then set it to the correct path. If the property does not exist, then add the same.
    1. set JBOSS_HOME=D:\jboss6
    2. set JBOSS_CLASSPATH=%RUN_CLASSPATH%;D:\jboss6\server\App\conf\properties;
    3. set "JAVA_HOME=D:\jdk1.6.0_25"
Install Service
  1. Open Command Prompt (Run as Administrator if applicable) and change directory to <jboss>\bin\
  2. Execute following command.
    service_App.bat install
  3. Open Windows services, Service with the name “App JBoss Server 6.0”should be visible now. Try refresh if the services management snap in is already open.
  4. Start service; wait for some time to get the service initialize.
  5. View <Jboss_home>/server/App/logs/boot.log and check for any errors.
  6. Service installation is completed at this point.
Uninstall Service
  1. Open Command Prompt (Run as Administrator if applicable) and change directory to <jboss>\bin\
  2. Execute following command.
    service_App.bat uninstall
  3. Open Windows services, Service with the name “App JBoss Server 6.0”should have been disappeared now. Try refresh if the services management snap in is already open.
For Multiple server setup
Create copy of the <Jboss>\bin\service.bat into another file with name ‘service_App1.bat’, ‘service_App2.bat’ and so on.
Configuration for first server.
  1. Edit File service_App1.bat & change following Properties.
    1. Search for
      set "SVCNAME=JBAS60SVC"
      Change it to
      set "SVCNAME=App1_Jboss"
    2. Search for
      set SVCDISP=JBoss Application Server 6.0
      Change it to
      set SVCDISP=App1 JBoss Server 6.0
    3. Search for
      set SVCDESC=JBoss Application Server 6.0.0 GA/Platform: Windows %PROCESSOR_ARCHITECTURE%
      Change it to
      set SVCDESC=App1 JBoss Server 6.0.0 GA/Platform: Windows %PROCESSOR_ARCHITECTURE%
    4. Search for
      jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service.bat
      Change it to
      jbosssvc.exe -imwdc %SVCNAME% "%DIRNAME%" "%SVCDISP%" "%SVCDESC%" service1_App.bat
    5. Search for (this will appear twice)
      call run.bat < .r.lock >> run.log 2>&1
      Change it to (Change both instance)
      call App1.bat -c App -b 0.0.0.0 < .r.lock 2>&1
      If the server is running on specific IP then change it with following
      call App1.bat -c App -b <IP_ADDRESS> < .r.lock 2>&1
    6. Search for (this will appear twice)
      call shutdown -S < .s.lock >> shutdown.log 2>&1
      Change it to (Change both instance)
      call shutdown --host=127.0.0.1 --port=1090 -S < .s.lock >> shutdown.log 2>&1
      If the server is running on specific IP then change it with following
      call shutdown --host=<IP_ADDRESS> --port=1090 -S < .s.lock >> shutdown.log 2>&1
  2. Edit file App.bat and verify if following properties are set to correct path, if not then set it to the correct path. If the property does not exist, then add the same.
    1. set JBOSS_HOME=D:\jboss6
    2. set JBOSS_CLASSPATH=%RUN_CLASSPATH%;D:\jboss6\server\App1\conf\properties;
    3. set "JAVA_HOME=D:\jdk1.6.0_25"
Install First Service
  1. Open Command Prompt (Run as Administrator if applicable) and change directory to <jboss>\bin\
  2. Execute following command.
    service_App1.bat install
  3. Open Windows services, Service with the name “App1 JBoss Server 6.0”should be visible now. Try refresh if the services management snap in is already open.
  4. Start service; wait for some time to get the service initialize.
  5. View <Jboss_home>/server/App1/logs/boot.log and check for any errors.
  6. Service installation is completed at this point.
Configuration for next servers
Follow steps 1 to 8 in previous section by replacing App1 with App2, wherever is applicable and go on by incrementing the number.

No comments:

Post a Comment