While there are a few ways to make this into a Windows service, I would like to discuss the WebLogic tool installsvc.cmd. This is how to add native WebLogic deployments as Windows Services.
First, review and follow the instructions to deploy the typical J2EE Agent in WebLogic
ODI11g: Deploying and Configuring the ODI Agent as a Java EE Application
http://www.oracle.com/webfolder/technetwork/tutorials/obe/fmw/odi/odi_11g/setup_jee_agent/setup_jee_agent.htm
Next, How do you configure this as a Windows Service?
So after reviewing the documentation, it is relativity easy to use the WebLogic tool installsvc to add the windows service,
There are scripts that can be used to set the environment variables and run the command line for using the installsvc command. Following the template, and setting the respective ODI related parameters gives this bat file that can be used to install ODI as a Windows Service
@rem *************************************************************************
@rem This script sets up a WebLogic Server instance as a Windows service.
@rem It sets variables to specify the domain name, server name, and optionally,
@rem user credentials, startup mode, and arguments for the JVM. Then the script
@rem calls the %WL_HOME%\server\bin\installSvc.cmd script.
@rem *************************************************************************
echo off
SETLOCAL
@rem Set DOMAIN_NAME to the name of the domain in which you have defined
@rem the server instance.
set DOMAIN_NAME=ODI-DOMAIN
@rem Set USERDOMAIN_HOME to the root directory of the domain's Administration
@rem Server, which is the directory that contains the domain's config.xml file.
@rem For more information about the root directories for servers, refer to
@rem A Server's Root Directory.
set USERDOMAIN_HOME=D:\Oracle\Middleware\user_projects\domains\ODI-DOMAIN
set ADMIN_URL=http://localhost:7001
@rem Set SERVER_NAME to the name of the existing server instance that you want
@rem set up as a Windows service.
set SERVER_NAME=odi_server1
@rem Optional: one way of bypassing the username and password prompt during
@rem server startup is to set WLS_USER to your system username and WLS_PW to
@rem your password. The script encrypts the login credentials and stores them
@rem in the Windows registry.
@rem The disadvantage to this method is that changing the username or password
@rem for the server instance requires you to delete the Windows service and set
@rem up a new one with the new username and password.
@rem If you use a boot identity file to bypass the prompt, you can change the
@rem login credentials without needing to modify the Windows service. For more
@rem information about bypassing the username and password prompt, refer to
@rem "Bypassing the Prompt for Username and Password" in the Administration
@rem Console Online Help.
set WLS_USER=weblogic
set WLS_PW=xxxxxxx
@rem Optional: set Production Mode. When STARTMODE is set to true, the server
@rem starts in Production Mode. When not specified, or when set to false, the
@rem server starts in Development Mode. For more information about
@rem Development Mode and Production Mode, refer to
@rem "Starting in Development Mode or Production Mode" in the Administration
@rem Console Online Help.
set STARTMODE=true
@rem Set JAVA_OPTIONS to the Java arguments you want to pass to the JVM. Separate
@rem multiple arguments with a space.
@rem If you are using this script to set up a Managed Server as a Windows service,
@rem you must include the -Dweblogic.management.server argument, which
@rem specifies the host name and listen port for the domain's Administration
@rem Server. For example:
@rem set JAVA_OPTIONS=-Dweblogic.management.server=http://adminserver:7501
@rem For more information, refer to
@rem "weblogic.Server Configuration Options" in the WebLogic Server Command
@rem Reference.
call D:\Oracle\Middleware\wlserver_10.3\common\bin\commEnv.cmd
set JAVA_OPTIONS=
@rem Optional: set JAVA_VM to the java virtual machine you want to run.
@rem For example:
@rem set JAVA_VM=-server
#set JAVA_VM=
@rem Set MEM_ARGS to the memory args you want to pass to java. For example:
@rem set MEM_ARGS=-Xms32m -Xmx200m
set MEM_ARGS=-Xms768m -Xmx768m
@rem Call Weblogic Server service installation script. Replace <WL_HOME> with
@rem the absolute pathname of the directory in which you installed WebLogic
@rem Server. For example:
@rem call "D:\bea\weblogic810\server\bin\installSvc.cmd"
call "D:\Oracle\Middleware\wlserver_10.3\server\bin\installSvc.cmd"
ENDLOCAL
Note the use of the parameter: set ADMIN_URL=http://localhost:7001
If you do not specify this parameter, then WebLogic thinks you are trying to start the admin server and will bail out when it does not find the admin server domain. In this case we are trying to connect to the odi managed server through the use of the ADMIN_URL parameter.
Now that the service has been installed, the service may or may not come up the first time...
Starting the Windows Service is pretty much is a black box. It is very likely this will not work the first time and there are no messages that appear to help debug the issue.
A very useful command to debug the service is:
D:\Oracle\Middleware\wlserver_10.3\server\bin>beasvc.exe -debug "beasvc ODI-DOMAIN_odi_server1"
Debugging service ....... beasvc ODI-DOMAIN_odi_server1
Command Line: ....... -jrockit -Xms128m -Xmx256m -Xverify:none -classpath "d:\Oracle\MIDDLE~1\patch_wls1036\profiles\default\sys_manifest_classpath\weblogic_pa...
This will stream output to the command line during startup of the WebLogic service and show you any errors.
If an issue is encountered with the service, the respective .bat file to remove the Windows Service and try again is:
@rem *************************************************************************
@rem This script is used to uninstall a WebLogic Server service for a
@rem server instance that is defined for the current domain.
@rem The script simply sets the DOMAIN_NAME and SERVER_NAME variables and calls
@rem the %WL_HOME%\server\bin\uninstallSvc.cmd script.
@rem *************************************************************************
echo off
SETLOCAL
@rem Set DOMAIN_NAME to the name of the domain that contains the server.
set DOMAIN_NAME=ODI-DOMAIN
@rem Set SERVER_NAME to the name of the server that you want to remove as
@rem a service.
set SERVER_NAME=odi_server1
@rem Call Weblogic Server service uninstallation script. Replace <WL_HOME> with
@rem the absolute pathname of the directory in which you installed WebLogic
@rem Server. For example:
@rem call "D:\bea\weblogic810\server\bin\uninstallSvc.cmd"
call "D:\Oracle\Middleware\wlserver_10.3\server\bin\uninstallSvc.cmd"
ENDLOCAL
If this fails to remove, ensure the DOMAIN_NAME matches the exact version that you used in the install script. In fact, even a rogue space at the end of the domain name can trip it up - so be careful of any trailing whitespaces.
I ran into an error with the CLASSPATH while starting the managed server, the error was
Failed to invoke startup class "JRF Startup Class", java.lang.ClassNotFoundException: oracle.jrf.wls.JRFStartup
java.lang.ClassNotFoundException: oracle.jrf.wls.JRFStartup
After some investigation, I found this thread, mentions a method to add some parameters directly to the installsvc.cmd script which will help the CLASSPATH resolve,
https://kr.forums.oracle.com/forums/thread.jspa?threadID=1009421
put this in installsvc.cmd
call D:\Oracle\Middleware\user_projects\domains\ODI-DOMAIN\bin\setDomainEnv.cmd
Finally, I once again removed the Windows Service, added it again.... And ODI Agent starts up via Windows Service!
No comments:
Post a Comment