Creating and configuring listeners  Changing the effective user ID of the server process

Chapter 3: Creating and Configuring Servers

Starting the server

Before you can develop EAServer applications, you must start the server.

You can run a server in different modes, debug and normal, using different Java runtime versions and different Java virtual machines (VMs). To start the server in the desired configuration, change to the EAServer bin subdirectory and run either serverstart.sh (UNIX) or serverstart.bat (Windows) with the options described in Table 3-11.

Table 3-11: Server start options

Option

Description

-servername server

Specifies the name of the server; the default is “Jaguar”.

-jdk13 | -jdk14

Specifies the JDK version; the default is 1.3.

-IPV4 | -IPV6

Specifies which Internet protocol versions to support. -IPV4, the default, supports Internet Protocol Version 4 (IPV4). -IPV6 specifies support for IPV6 and IPV4. For more information, see “IPV6 support”.

-compilerversion [4x | 6x]

Solaris only. Specifies whether to run with libraries and binaries that are compatible with the version 6.x Solaris CC compiler format, or the version 4.x format. If not specified, the default is version 6.x compatibility.

-debug

Runs the server in debug mode.

-xterm

UNIX only. Runs the server in a new window opened by xterm.

-jvmtype [classic | client | server]

Specifies which Java VM to use:

  • Classic – classic Java VM

  • Client – HotSpot Client VM

  • Server – HotSpot Server VM

If you run JDK 1.4, you can choose either of the HotSpot VMs; the default is the HotSpot Client VM. The classic VM is not supported with JDK 1.4.

On Solaris, if you use JDK 1.3, you can run either of the HotSpot VMs.

On Windows, if you run JDK 1.3, the default is the HotSpot Client VM.

-altthrdlib

On Solaris 2.8 systems, specifying this option causes EAServer to run with the alternate JDK thread library that uses one-to-one mapping between kernel threads and Java threads. This threading model can yield better performance and reliability than the default many-to-many threading model.

-jpdasuspend

When using the JPDA Java debugging option, you can specify this option to suspend the server at start-up time. This allows you to set break points in code that executes at start-up time, such as servlets that are configured to load on start-up. You can resume execution of the server with your Java debugger.

-msdev | -devenv

Windows only – enables in-process debugging in Microsoft Visual C++.

  • -msdev starts the server in Visual C++ version 5 or 6.

  • -devenv starts the server in Visual C++ version 7.

The required Microsoft Visual C++ environment settings must be in effect for the server process. In bin\user_setenv.bat, set the VC variable to the Visual C++ installation, where vc_path\bin is the location of the vcvars32.bat file:

set vc=c:\vc_path
-workshop

Solaris only – enables in-process debugging in the Workshop debugger. Define the location of the Workshop debugger by setting the WORKSHOP_DIR variable in the user_setenv.sh file; for example:

WORKSHOP_DIR=/OPT/SUNWspro6.2/
export WORKSHOP_DIR

For information about the Sun Workshop debugger, see the Workshop Web page.

-install | -uninstall | 
-remove | -removeandinstall | 
-stop | -start | -c

Windows only – these options apply to servers that run as Windows services:

  • -install installs the server as a Windows service.

  • -uninstall and -remove uninstall the server from the list of Windows services.

  • -removeandinstall removes the server from the list of Windows services, then reinstalls it.

  • -stop shuts down a server that has been installed as a Windows service. You can also stop the server using the Services dialog in the Control Panel, or from EAServer Manager.

  • -start starts a server that has been installed as a Windows service. When installed as a service, the server starts automatically when Windows starts. Use this option only after you have stopped or shut down the server.

  • -c (the default) starts the server as a console application. Use this option if you have configured the server to run as a Windows service, but you want to run it in a console.

-servicename service

Windows only – if running or installing a server as a Windows service, specifies a service name. If not specified, the default is the server name.

-v

Windows only – displays version information in the console, then exits.

“Operating system configuration” describes how to set environment variables that you may need to run the server.

StepsStarting a server in UNIX

  1. Add the location of the X-Windows xterm utility to your path variable. For example:

    set path = ($path /usr/local/SUNWmotif/bin/)
    
  2. Edit the $JAGUAR/bin/setenv.sh shell script. Change the JAGUAR variable to the EAServer home directory, then run the serverstart.sh script, using this syntax:

    serverstart.sh [-servername server] [-jdk13] [-jdk14] \
       [-debug] [-xterm] | [-jvmtype classic | client | server]
       [-workshop]
    

    See Table 3-11 for a description of the server options.

NoteDebug servers Debug servers allow you to remotely debug components from tools that support EAServer component debugging, such as PowerBuilder or PowerJ. You cannot run the debug server unless you installed the debug libraries and binaries. The debug server cannot run as a Windows service.

Running servers in the background

You should run production servers in the background with the nohup command. This allows you to log out of the system without shutting down the server.

To run a server in the background, change to the $JAGUAR directory, and run this command:

nohup ./serverstart.sh -servername server > serverconsole.log 2>&1 &

where server is the server name as displayed in EAServer Manager. nohup runs the server and prevents its shutdown when you log out. Console output (stderr and stdout) is directed to a file named serverconsole.log.

StepsStarting a server in Windows

  1. Change to the %JAGUAR%\bin directory, and run serverstart.bat using this syntax:

    serverstart [-servername server] [-jdk13 | -jdk14] [-debug] \
       [-msdev | -devenv] [-jvmtype classic | client | server] \
       [-install | -uninstall | -remove | -removeandinstall | \
        -stop | -start | -c] [-v]
    

    See Table 3-11 for a description of the server options.

Starting servers that are installed as Windows services

If a server is installed as a Windows service, the server is started automatically when you start Windows. To start a service manually, use the Services dialog in the Windows Control Panel.

On Windows 2000 and Windows XP:

  1. Select Start | Settings | Control Panel | Administrative Tools | Services.

  2. In the list of Services, find the name of your server (for example, the preconfigured server is “Jaguar”).

    To stop the server, double-click the server name, and in the server Properties dialog box, click Stop.

    To start the server, double-click the server name, and in the server Properties dialog box, click Start.

You can also run this command in the EAServer bin subdirectory:

serverstart -servername service_name -start

where service_name is the name of the server. To stop the server, use:

serverstart -servername service_name -stop

Installing servers as Windows services

You should install production servers as Windows services, so the servers start automatically when Windows starts. Do not install development servers as Windows services, since you will often want to run the debug server on your development machine, and you cannot run the debug server as a Windows service.

StepsInstalling a server as a Windows service

  1. If the server is not running, start it on the desktop.

  2. Start EAServer Manager and connect to the server using EAServer Manager.

  3. Configure any environment variables required for the server process. The JAGUAR, PATH, CLASSPATH, BOOTCLASSPATH, and BOOTLIBRARYPATH environment variables are saved in the Windows Registry when you install the server as a service. These variables keep the values they have when the server is installed as a service. You must set other variables in the server properties file, using the Advanced tab to specify values as described in Environment variable properties. Settings in the start-up scripts (serverstart.bat, setenv.bat, and user_setenv.bat) are not applied when the server starts as a service.

  4. Shut down the server by highlighting its icon and choosing File | Shutdown.

  5. Run the following command in the EAServer bin subdirectory, specifying the server name in place of server and the JDK version string in place of jdk:

    serverstart -servername server -jdk -install
    

    JDK version

    JDK version string

    1.4

    jdk14

    1.3

    jdk13

    For debugging, you can use the following options when you install the server:

    Option

    Description

    -servicesleep n

    Causes the service to sleep n seconds during start-up. Set n to a value large enough to allow you time to connect to the process.

    -svclog

    Specifies the full path and name of a log file to capture debug information about the service; installing, starting, stopping, and running.

StepsRemoving a server from the list of Windows services

  1. Run the command:

serverstart -servername servicename -remove

where servicename is the name of the server as displayed in the Services dialog box.

NoteEdit service names separately If you delete a server definition in EAServer Manager after installing a Windows service for that server, run the serverstart command to remove the server from the list of services.

Determining server version level

Run the following command from the EAServer bin subdirectory:

serverstart -servername server -v

This command displays the version of the server, without starting the server.





Copyright © 2005. Sybase Inc. All rights reserved. Changing the effective user ID of the server process

View this book as PDF