Wednesday, January 19, 2011

How to Install MS Windows Services For Oracle Middleware 11g Rel 1 WebLogic Admin and Managed Servers? [ID 1060058.1]




Note: Document copied from support.oracle.com for personal reference
Applies to: Oracle Weblogic Server - Version: 10.3.1 to 10.3.3
Oracle Fusion Middleware - Version: 11.1.1.1.0 to 11.1.1.3.0]
Generic Windows

Goal

By default the only Fusion Middleware 11g components configured as MS Windows Services by the install process are:

  • Weblogic Node Manager
    (configured as a MS Windows Service if Custom Install route is chosen when installing Weblogic)
  • FMW 11g Process Manager (OPMN)
    (installed as a MS Windows Service if a System Component Instance is configured)
How to install MS Windows Services for Fusion Middleware (FMW) 11g Weblogic Admin or Managed Servers?


Important to Note:

To quote from

Oracle Fusion Middleware Managing Server Startup and Shutdown for Oracle WebLogic Server 11g Release 1 (10.3.3)
Chapter 3 Setting Up a WebLogic Server Instance as a Windows Service

"When you start the Windows host, the Windows Service Control Manager (SCM), which is part of the Windows operating system, uses the information in the Windows Registry key to invoke the weblogic.Server main class.

The Windows SCM cannot be configured to use a Node Manager to start Managed Servers, and therefore the Node Manager's monitoring and automatic restart features cannot be used for servers that run as a Windows service.
"

This has implications for the start, stop and monitoring of Weblogic Managed Servers via the Weblogic Admin Console as the Admin Console interacts with Node Manager. If you primarily want to use Weblogic Admin Console to control the managed servers then do NOT configure managed servers as MS Windows Services.

Solution

Introduction

Weblogic (WLS) admin and managed servers can only be configured as MS Windows services after a Weblogic domain has been created. It is achieved by manually running a cmd script.

The advice below can applied to generic Oracle Weblogic domains or FMW 11g Component Domains such as 'SOA', 'WebCenter', 'Identity Management' or 'Portal/Forms/Reports/Discoverer'.

The technique is discussed in the documentation

Oracle Fusion Middleware Managing Server Startup and Shutdown for Oracle WebLogic Server 11g Release 1 (10.3.3)
Chapter 3 Setting Up a WebLogic Server Instance as a Windows Service

The examples given below are for an Admin Server and WLS_FORMS belonging to a Forms / Reports Domain.
Firstly some MS Windows 64bit specific advice

If you are using MS Windows 64bit, edit the MIDDLEWARE_HOME\wlserver_10.3\server\bin\installSvc.cmd

If the WebLogic Domain is using Sun JDK, add "set JAVA_VM=-server",
if the WebLogic Domain is using JRockit, add "set JAVA_VM="-jrockit"

Example for Domain based on Sun JDK:



set JAVA_VM=-server

if "%ADMIN_URL%" == "" goto runAdmin
set CMDLINE="%JAVA_VM% %MEM_ARGS% %JAVA_OPTIONS% -classpath \"%CLASSPATH%\" -Dweblogic.Name=%SERVER_NAME%

-Dweblogic.management.username=%WLS_USER% -Dweblogic.management.server=\"%ADMIN_URL%\
etc..

If the JAVA_VM mode is not changed from the default '-client' to '-server' the WebLogic Managed Server will fail to start as a MS Windows Service

Reference:
Note:1157875.1 Trying to Start a Weblogic Admin Server or Managed Server via a Service on 64bit Windows Fails with "Unable to Find a JVM"
For an Admin Server

1. Create a text file

%MIDDLEWARE_HOME%\user_projects\domains\<domain name>\servers\AdminServer\security\boot.properties

Add the following lines

username=weblogic
password=<the weblogic username password e.g manager11g)>

Reference:
Note:980292.1 Starting AdminServer Without Username/Password Prompt in WebLogic Server 10.3

As soon as you start the Admin Server the username and password values in this file will be encrypted.

2. Create a command script called installAdmServer_Service.cmd which has lines like


SETLOCAL
set DOMAIN_NAME=ClassicDomain
set USERDOMAIN_HOME=C:\middleware\FMW11g\user_projects\domains\ClassicDomain
set SERVER_NAME=AdminServer
set PRODUCTION_MODE=true
cd %USERDOMAIN_HOME%
call %USERDOMAIN_HOME%\bin\setDomainEnv.cmd
call "C:\middleware\FMW11g\wlserver_10.3\server\bin\installSvc.cmd"
ENDLOCAL

3. For troubleshooting / debugging purposes it is helpful to redirect standard out and error to a text file. Although most information is captured in the AdminServer server log files, you will not see all standard out and error when the server is started via a MS Windows Service (unlike when you start an AdminServer from the command prompt using startWebLogic.cmd). To redirect standard out to a text file, backup and edit installSvc.cmd and change the line at the bottom of the file so it include the -log parameter e.g


"%WL_HOME%\server\bin\beasvc" -install
-svcname:"%DOMAIN_NAME%_%SERVER_NAME%"
-javahome:"%JAVA_HOME%" -execdir:"%USERDOMAIN_HOME%"
-extrapath:"%WL_HOME%\server\bin" -password:"%WLS_PW%"
-cmdline:%CMDLINE%
-log:"C:\Middleware\FMW11g\user_projects\domains\ClassicDomain\%SERVER_NAME%-stdout.txt"

4. Now run "installAdmServer_Service.cmd". The Service should be installed, it will have a name like ""beasvc %DOMAIN_NAME%_%SERVER_NAME%" e.g

beasvc ClassicDomain_AdminServer

The Service "Startup Type" will be 'Automatic'. Just like any other MS Windows Service you can change the 'Startup Type' to 'Manual'.

Start the Service. The Service will come back fairly quickly to say it is started. The actual time taken for AdminServer to start and reach a state of 'RUNNING' will be longer - perhaps two or three minutes. The state of the server can be monitored by reviewing the stdout txt file.

Notes:

An alternative to the boot.properties approach to specifying the Admin Server weblogic username / password is to add the following environment variables to your wrapper cmd script - installAdmServer_Service.cmd

set WLS_USER=weblogic
set WLS_PW=manager11g

To quote the documentation


The beasvc utility encrypts the login credentials and stores them in the Windows registry.

This is one of two possible methods for avoiding the username/password prompt when a server instance starts. The disadvantage to this method is that changing the username or password for the server instance requires you to delete the Windows service and set up a new one with the new username and password. Instead of this method, you can use a boot identity file. With a boot identity file, you can change the login credentials without needing to modify the Windows service.
For a managed server e.g WLS_FORMS

1. Create a text file

%MIDDLEWARE_HOME%\user_projects\domains\<domain name>\servers\WLS_FORMS\security\boot.properties

Add the following lines

username=weblogic
password=<the weblogic username password e.g manager11g)>

As soon as you start the managed server the username and password values in this file will be encrypted. The alternative approach - like for AdminServer - is to specify WLS_USER and WLS_PW in the wrapper cmd script. See next point

2. Create a command script called installWLSFORMS_Service.cmd which has lines like


SETLOCAL
set DOMAIN_NAME=ClassicDomain
set USERDOMAIN_HOME=C:\middleware\FMW11g\user_projects\domains\ClassicDomain
set SERVER_NAME=WLS_FORMS
set PRODUCTION_MODE=true
set ADMIN_URL=http://mymachine.mycompany.com:7001
cd %USERDOMAIN_HOME%
call %USERDOMAIN_HOME%\bin\setDomainEnv.cmd
call "C:\middleware\FMW11g\wlserver_10.3\server\bin\installSvc.cmd"
ENDLOCAL

Notes:

a) The ADMIN_URL value should reference the AdminServer hostname and listen port

b) The SERVER_NAME value is case sensitive. For example, if you are creating a MS Windows service for a different managed server such as 'wls_ods1' then the value needs to match the case of the server name otherwise the startup of the server via the MS Windows service will fail.

c) Be careful that there are no trailing spaces after each line in the command file - trailing spaces will cause the managed server to fail at startup. For example a trailing space in the ADMIN_URL value will result in the error

<19-Jan-2010 11:37:58 o'clock GMT> <Error> <EmbeddedLDAP> <BEA-171524> <Cannot determine the Listen address for the Admin server

3. Now run "installWLSFORMS_Service.cmd". The Service should be installed, it will have a name like ""beasvc %DOMAIN_NAME%_%SERVER_NAME%" e.g

beasvc ClassicDomain_WLS_FORMS

The Service "Startup Type" will be 'Automatic'. Just like any other MS Windows Service you can change the 'Startup Type' to 'Manual'.

Start the Service. The Service will come back fairly quickly to say it is started. The actual time taken for the managed server to start and reach a state of 'RUNNING' will be longer - perhaps two or three minutes. The state of the server can be monitored by reviewing the stdout txt file.
And Finally:

The following enhancement request exists regards automating the creation of such services in a future release of Fusion Middleware 11g

Bug:9285337 Abstract: MANAGED SERVERS FOR WLS_FORMS AND WLS_REPORTS DON'T GET STARTED AUTOMATICALLY

Keywords
-------------------------------------------------------------------------------------------
WLS Weblogic MS Win Service automate startup automatically WLS_FORMS WLS_REPORTS WLS_DISCOVERER WLS_PORTAL SOA WebCenter

References

NOTE:1157875.1 - Trying to Start a Weblogic Admin Server or Managed Server via a Service on 64bit Windows Fails with "Unable to Find a JVM"
NOTE:980292.1 - Starting AdminServer Without Username/Password Prompt in WebLogic Server 10.3
Bug:9346814 Abstract: DOCS - NEED TO DOC STARTING FMW 11 MANAGED SERVERS AS A WINDOWS SERVICE
Bug:9346749 Abstract: DOCS - PASTING SAMPLE WINDOWS SERVICE CREATION SCRIPT LEADS TO FAILURE
Bug:9285337 Abstract: MANAGED SERVERS FOR WLS_FORMS AND WLS_REPORTS DON'T GET STARTED AUTOMATICALLY
Bug:8989011 Abstract: DOCS - WHERE ARE THE STEPS ON STARTING WLS_FORMS AS A WINDOWS SERVICE?


Back to top

1 comment:

  1. Hello
    I tried to create the Weblogic Nodes windows service and got this error in the service_start.log

    INFO: Notification event sent for activating changes.
    <08-Oct-2012 01:54:34 o'clock BST>
    <08-Oct-2012 01:54:34 o'clock BST>
    java.lang.OutOfMemoryError: PermGen space
    [Mon Oct 08 01:55:41 2012] [E] [RunJavaApp] Exception occurred invoking main class [java.lang.OutOfMemoryError: PermGen space

    What's the problem???

    Emekachu@Googlemail.com

    ReplyDelete