Oracle‎ > ‎Misc‎ > ‎

WL 11g Services

Note: Check this for creating Weblogic Services actual Examples working in all EPM/OBIEE etc conditions..... http://www.openepm.com/oracle/epm-weblogic-admin-service

Applies to: Oracle Weblogic Server - Version 10.3.1 to 10.3.5
Oracle Fusion Middleware - Version 11.1.1.1.0 to 11.1.2.0.0 [Release Oracle11g]
Generic Windows

Purpose

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)

This document discusses how to install MS Windows Services for Fusion Middleware (FMW) 11g Weblogic Admin Server and Managed Servers.

Scope

The advice in this document is intended for System Administrators, Consultants and Support engineers. It assumes that a Fusion Middleware 11g architecture on MS Windows is in place.

Details

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 input line is too long. Syntax error"

MS Windows 32bit has 2K limitation on the length of the command line. If the classpath setting in the " installSvc.cmd " is very long, the 2K limitation could be exceeded. Consequently the set up of the MS Windows Service will fail with the error

The input line is too long. Syntax error

The error may also be seen on MS Windows 64bit platforms.

To work-around, place the CLASSPATH value in a txt file

C:\> echo %CLASSPATH% > classpath.txt

and refer to this classpath.txt in the cmd scripts - in place of %CLASSPATH%

For more detail, refer to:

Oracle Fusion Middleware Managing Server Startup and Shutdown for Oracle WebLogic Server 11g
Chapter 3 Setting Up a WebLogic Server Instance as a Windows Service
Adding Classes to the Classpath

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:

@echo off

set JAVA_VM=-server

if "%ADMIN_URL%" == "" goto runAdmin
@echo on
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"

Admin and Managed Server JVM Memory Settings

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

However, you must bear in mind that if you follow the basic steps / advice given in the "Oracle Fusion Middleware Managing Server Startup and Shutdown for Oracle WebLogic Server 11g" you will start up the WebLogic Servers with relatively low JVM minimum and maximum memory sizes. Some products have higher JVM memory requirements, and as such low settings can result, for example, in a managed server hang or a " java.lang.OutOfMemoryError " failure e.g.

Note 1312573.1 Admin Server Started as a Windows Service Fails with BEA-101216: java.lang.OutOfMemoryError: PermGen space

Therefore, it is important to ensure that the MS Windows Service for the managed server is configured with the JVM memory settings which are appropriate for your chosen product and/or application.

How to influence the JVM memory settings configured within a MS Windows Service?

The easiest approach is to create a copy of the default " %WL_HOME%\server\bin\installSvc.cmd " script. Edit the copy so the script points at your domain's setDomainEnv command line script. By default, installSvc.cmd points at %WL_HOME%\common\bin\commEnv.cmd which contains this line setting relatively low JVM min and max memory values.

set MEM_ARGS=-Xms128m -Xmx256m

Example, make a copy of installSvc.cmd and label the file "myDomainInstallSvc.cmd". Edit myDomainInstallSvc.cmd, so it reads

set WL_HOME=D:\product\FMW11g\wlserver_10.3
set MYDOMAIN=D:\product\FMW11g\user_projects\domains\myDomain
call "%MYDOMAIN%\bin\setDomainEnv.cmd"

@rem commenting out the line below
@rem call "%WL_HOME%\common\bin\commEnv.cmd"

Then in your script to install a MS Windows Service for the servers belonging to the targeted domain, be sure to invoke your customised copy of "InstallSvc.cmd" e.g. "myDomainInstallSvc.cmd"

To change the JVM memory heap sizes after configuring a MS Windows Service, perform the following steps:
1. Edit the domain's setDomainEnv.cmd. You can change the default JVM heap sizes by
  • altering the value of the MEM_ARGS environment variable
    or
  • adding (or altering if it already exists) the value of the USER_MEM_ARGS environment variable
Note: The script, within setDomainEnv.cmd, which sets one or both of these environment variables may vary depending on the products configured in the WebLogic Domain. There is no tool or section in the Fusion Middleware 11g documentation which explicitly advises how to edit this environment variable setting command line script.

2. Deinstall / remove the MS Windows service.

The deinstall is required because the MS Windows Service does not dynamically read the setDomainEnv at startup time. Instead it reads the JVM heap settings from the MS Windows registry, these settings having been placed in the registry when the service was created. To view these parameters, open up the MS Windows Registry Editor (regedit) and navigate to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\beasvc _\Parameters

3. Re-install the MS Windows service. The service should pick up the new JVM memory heap settings from the altered setDomainEnv.cmd file.
Useful Reference:

For an explicit example featuring SOA, refer to:

Note 1312949.1 Using Windows Service To Start Weblogic Admin Server and a SOA server through the WLS Admin Console

Starting Managed Servers After Starting the Domain's Admin Server

If you set up both an Administration Server and a Managed Server to run as Windows services on the same computer, you can specify that the Managed Server starts only after the Administration Server.

To require a Managed Server to start after the Administration Server Windows service use the "-delay" parameter as per the instructions given in:

Oracle Fusion Middleware Managing Server Startup and Shutdown for Oracle WebLogic Server 11g Release 1
Requiring Managed Servers to Start After Administration Servers

Create a MS Windows Service for an Admin Server

1. Create a text file

%MIDDLEWARE_HOME%\user_projects\domains\servers\AdminServer\security\boot.properties

Add the following lines

username=weblogic
password=

Reference:
Note 980292.1 How to Start a WebLogic 10.3.x Domain AdminServer Without Interactively Supplying the Username / Password?

Important to Note:

a. If this step is not performed you will see the following generic error when the Admin Server is started in " background mode " via an MS Windows Service.

BEA-090403 Authentication for user weblogic denied

This error occurs because, by default, startup of Admin Server interactively prompts for the weblogic username and password. If the password is not supplied the error is thrown.
 
b. As soon as you start the Admin Server the username and password values in this file will be encrypted. Be sure to stop / start the Admin Server as soon as possible to ensure the credentials are not exposed for longer than necessary.

2. As discussed in the Hints / Tips section "Admin and Managed Server JVM Memory Settings" make a copy of %WL_SERVER%\server\bin\installSvc.cmd. The copy can reside in the same directory as the original.

Edit the copy (e.g. myDomainInstallSvc.cmd) so that the script points at your chosen domain's setDomainEnv.cmd script (rather than commEnv.cmd). This will ensure that the JVM memory size values are set appropriately.

3. 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\myDomainInstallSvc.cmd"
ENDLOCAL

4. 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 myDomainInstallSvc.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"

5. 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.

Create a MS Windows Service for a Managed Server e.g WLS_FORMS

1. Create a text file

%MIDDLEWARE_HOME%\user_projects\domains\\servers\WLS_FORMS\security\boot.properties

Add the following lines

username=weblogic
password=

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. As discussed in the Hints / Tips section "Admin and Managed Server JVM Memory Settings" make a copy of %WL_SERVER%\server\bin\installSvc.cmd. The copy can reside in the same directory as the original.

Edit the copy (e.g. myDomainInstallSvc.cmd) so that the script points at your chosen domain's setDomainEnv.cmd script (rather than commEnv.cmd). This will ensure that the JVM memory size values are set appropriately.

If you have already have a copy of installSvc.cmd as a result of working through the steps to create a MS Windows Service for the Admin Server you can ignore this step. The same copy can be used for the install of a MS Windows service for a managed server belonging to the same domain as the Admin Server.

2. Create a command script called, for example, 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\myDomainInstallSvc.cmd"
ENDLOCAL

Important to Note:

1. The ADMIN_URL value should reference the AdminServer hostname and listen port.

2. 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.

3. 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
 
<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.

Automating Start / Restart of WebLogic Servers via NodeManager

It is important to note that the Windows Services Manager only monitors the JVM process. If the JVM process fails (shuts down), then Windows Services Manager will attempt to restart it. But there are some scenarios where the Admin Server or Managed Server may go into an unhealthy or failed state but the JVM is still running. The Windows Service will not know to restart the process in these cases, whereas if the Admin Server and Managed Server had been started using Node Manager, Node Manager would recognize such a state and restart the process accordingly.

Therefore, it may be desirable to start Node Manager with a Windows Service and then start the Admin Server and Managed Servers with Node Manager to take advantage of this monitoring feature.

If you opt for this approach, you do not need to configure MS Windows Services for the WebLogic Admin Server and Managed Servers.

A Node Manager MS Windows service may have been created by the WebLogic Server install process. Check whether this is the case via the Windows Services Manager. If there is no service for Node Manager, use the following steps to create one.

WL_HOME\server\bin\installNodeMgrSvc.cmd

Verify in MS Windows Services that a service was created. Once a Node Manager MS Windows Service is in place implement an automatic startup Admin and Managed Server procedure as follows:

1. In order to avoid hardcoding the NodeManager credendials in the command script (see step 2) create a userConfigFile and userKeyFile i.e launch WLST, connect to the domain and then run the command "storeUserConfig". Example is given below:

call D:\Product\Oracle\Middleware\user_projects\domains\mydomain\bin\setDomainEnv.cmd

java weblogic.WLST

wls:/mydomain/serverConfig>connect('weblogic','weblogic','localhost:7001')

wls:/mydomain/serverConfig>storeUserConfig('D:/myFiles/myuserconfigfile.secure', 'D:/myFiles/myuserkeyfile.secure')

Creating the key file can reduce the security of your system if it is not kept in
a secured location after it is created. Do you want to create the key file? y or n

y

The username and password that were used for this current WLS connection are stored in D:/myFiles/myuserconfigfile.secure and D:/myFiles/myuserkeyfile.secure

wls:/mydomain/serverConfig>

2. Create a command and a python script which the operating system will call at start up time.

Myscript.cmd

call D:\Product\Oracle\Middleware\user_projects\domains\mydomain\bin\setDomainEnv.cmd
java weblogic.WLST D:\Product\Oracle\Middleware\user_projects\domains\mydomain\ServerStart.py

Create a Python script similar to this:

ServerStart.py
(111.222.3.444 represents an IP address, substitute the host machine ip address)

nmConnect(userConfigFile='D:/myFiles/myuserconfigfile.secure',userKeyFile='D:/myFiles/myuserkeyfile.secure',host='111.222.3.444',port='5556',domainName='mydomain',domainDir='D:\middleware\user_projects\domains\mydomain',mType='ssl')

nmStart('AdminServer')

connect('t3://111.222.3.444:7001')

nmStart('myManagedServer')

3. For the scripts above to run at machine boot up, schedule the script (myscript.cmd) to run from the Windows Scheduler.

Important Notes:

a) The startup.properties file for the Admin and Managed servers must have "AutoRestart=true." This can be set in the "Health Monitoring" tab for each respective server in the WebLogic Server Admin Console.

b) The boot.properties file must be configured and present for the Admin Server and for each managed server that you plan to start automatically.

c) If a Managed Server contains Oracle Fusion Middleware products, such as Oracle SOA Suite, Oracle WebCenter, or Oracle JRF, the Managed Servers environment must be configured to set the correct classpath and parameters. This environment information is provided through the start scripts, such as startWebLogic and setDomainEnv, which are located in the domain directory.

If the Managed Servers are started by Node Manager (as is the case when the servers are started by the Oracle WebLogic Server Administration Console or Fusion Middleware Control), Node Manager must be instructed to use these start scripts so that the server environments are correctly configured. Specifically, Node Manager must be started with the property StartScriptEnabled=true.

Refer to the advice given in:

Oracle Fusion Middleware Administrator's Guide 11g Release 1 (11.1.1)
4.2.4 Configuring Node Manager to Start Managed Servers

Documentation References:

Oracle Fusion Middleware Oracle WebLogic Scripting Tool 11g Release 1
Chapter 4 Managing the Server Life Cycle

Oracle Fusion Middleware WebLogic Scripting Tool Command Reference 11g Release 1
Chapter 3 WLST Command and Variable Reference
Connect Command
and
nmConnect Command

Additional Information

1. Tip: MS Windows writes the service parameters / details to the registry. If you want to view these parameters, open up the MS Windows Registry Editor (regedit) and navigate to:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\beasvc_\Parameters

2. To quote from the guide for "Managing Server Startup and Shutdown for Oracle WebLogic Server":

In a production environment, WebLogic Server Windows services should run under a special operating-system user account that has limited access privileges. For example, the OS user should have access privileges only to Oracle files and to your domain files. This should be the only user account that has access to these files.
..
When accessing network drives, the Windows service must run under the same user name as the one who shared the network drive.

For more detail, review "Verifying the User Account Under Which the Service Runs"

3. As with any MS Windows Service, it is possible to configure the service to restart itself upon failure. These are standard options available when configuring a Windows Service in the context of Windows Services Manager.

4. The documentation

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

provides some useful advice regards verifying / debugging the MS Windows Service setup. Take a look at

Verifying the Setup

5. 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

References

@ BUG:14018851 - ADD ADMINSERVER AS A SERVICE DURING FMW INSTALLATION

Show Related Information Related


Products
  • Middleware > Application Servers > Weblogic Server > Oracle Weblogic Server
  • Middleware > Application Servers > Oracle Application Server > Oracle Fusion Middleware
Keywords
11G; ADMINSERVER; AUTOMATIC; AUTOMATICALLY STARTED; BOOT.PROPERTIES; DYNAMIC ADV INSTALL INDEX; INSTALL; MANAGED SERVER; NODE MANAGER; NODEMANAGER; ORACLE FUSION MIDDLEWARE; ORACLE WEBLOGIC SERVER (Q5242); SERVICES; SHUTDOWN; STARTUP; WEBLOGIC; WINDOWS; WINDOWS SERVICE; WLS_FORMS; WLS_REPORTS
Errors
BEA-101216; BEA-171524; BEA-90403

Back to topBack to top