The Support Authority: Take the confusion (and errors) out of creating Windows services for WebSphere Application Server

Using the WASService command for creating or removing an IBM® WebSphere® Application Server service in Windows® can be confusing and error prone. A new interactive utility prompts you to select specific options and settings from a list and then calls the WASService command passing all selected parameters. This greatly reduces the time it takes to create a Windows service for WebSphere Application Server and reduces the opportunity for user errors. This content is part of the IBM WebSphere Developer Technical Journal.

Paul Van Norman (vanno@us.ibm.com), WebSphere Application Server L2 Team, IBM

Paul Van Norman received B.Sc. in Computer Science in 1996 from the University of Regina. He moved from Regina, Canada to Austin, Texas where he has been working in WebSphere Application Server Level 2 support since May, 2000. Paul is the team lead of the WASADM team and has previously led several other L2 teams. Paul enjoys the outdoors and can often be seen in the Texas hill country back roads on his trusted Honda motorcycle.



Dr. Mahesh Rathi (mrathi@us.ibm.com), WebSphere Application Server SWAT Team, IBM

Dr. Mahesh Rathi has been involved with WebSphere Application Server product since its inception. He led the security development team before joining the L2 Support team, and joined the SWAT team in 2005. He thoroughly enjoys working with demanding customers, on hot issues, and thrives in pressure situations. He received his PhD in Computer Sciences from Purdue University and taught Software Engineering at Wichita State University before joining IBM.



26 May 2010

Also available in Chinese

In each column, The Support Authority discusses resources, tools, and other elements of IBM® Technical Support that are available for WebSphere® products, plus techniques and new ideas that can further enhance your IBM support experience.

This just in...

As always, we begin with some new items of interest for the WebSphere community at large:

Continue to monitor the various support-related Web sites, as well as this column, for news about other tools as we encounter them.

And now, on to our main topic...


Using interactive tools to avoid confusion and errors

WASService.exe is required in the default directory for adding, updating, and removing WebSphere Application Server services in Windows. The WASService command takes several parameters along with several long path strings. Not only can this be confusing to anyone who tries to use it, but it also open an opportunity to set it up incorrectly.

For example, WASService -add has three required and nine optional parameters, shown in Figure 1.

Figure 1. WASService command
Figure 1. WASService command

Providing all these parameters on the command line can be time consuming and frustrating, but it can also be error prone and confusing. Beyond that, it can sometimes take an hour or more to debug the cause of a service that was created but fails to start WebSphere Application Server.

Listing 1 shows and example of the WASService command line arguments for creating a Windows service.

Listing 1
WASService.exe -add "vanno"
 -serverName "dmgr"
 -profilePath "C:\Program Files\IBM\WebSphere\AppServer\profiles\Dmgr02"
 -logRoot "C:\Program Files\IBM\WebSphere\AppServer\profiles\Dmgr02\logs\dmgr"
 -logFile "C:\Program Files\IBM\WebSphere\AppServer\profiles\Dmgr02\logs\WS_startdmgr.log"
 -configRoot "C:\Program Files\IBM\WebSphere\AppServer\profiles\Dmgr02\config"
 -encodeParams
 -stopArgs "-username wasadmin -password mypassword"
 -startType automatic
 -restart true

Windows services for WebSphere Application Server can be used, for example, to start WebSphere Application Server manually or automatically when the Windows operating system has been restarted, or to automatically restart if the process dies. WebSphere Application Server services can be created during profile creation in the Profile Management Tool, or using the WASService.exe command utility (see the WebSphere Application Server Information Center). Figure 2 shows a screen capture of the Windows Services panel. As highlighted in this figure, a service called IBM WebSphere Application Server V7.0 – vanno1Node01 has been defined.

Figure 2. Windows Services panel
Figure 2. Windows Services panel

To help you create WebSphere Application Serer services quickly and without confusion, the WASServiceCmd utility was developed. WASServiceCmd is a new interactive wizard to help you quickly manage Windows services for WebSphere Application Server V6.x and V7x. This wizard is a front end to the Wasservice.exe command line utility shipped with WebSphere Application Server in the bin directory. You can download this tool and then run it from <WebSphere_Install_Root>\bin\.

Supported management functions of this tool include the ability to:

  • Add a new or update an existing Windows service using the minimum required parameters.
  • Add a new or update an existing Windows service using all available parameters.
  • Remove a service.
  • Display the status of a service.
  • Enable WASService traces for problem determination.

Figure 3 shows the tool’s main menu.

Figure 3. WASServiceCmd.exe main menu
Figure 3. WASServiceCmd.exe main menu

To use this utility:

  1. Run WASServiceCmd.exe from the WebSphere/AppServer/bin directory.
  2. In response to Select number next to the options on the main menu, select item 1 to create a service using the minimum number of parameters (Figure 3).
  3. In response to Select number next to the profile, select the number associated with the profile for which you wish to create the service (Figure 4).
    Figure 4. Select profile
    Figure 4. Select profile
  4. In response to Select number next to server, select the server from the list. In the example shown in Figure 5, there is only one selection, dmgr. Also shown in Figure 5, hints and warnings display as you go (circled in the figure) to help you prevent common problems.
    Figure 5. Select server
    Figure 5. Select server
  5. Enter the Service Name for your service (Figure 6).
    Figure 6. Name service
    Figure 6. Name service
  6. In the next steps, accept the default values by pressing Enter, or make changes as needed:
    1. -startArgs and –stopArgs are not required options. Use these options to specify additional parameters used for starting and stopping the JVM process. For example, you may add username and password, as follows:

      -stopArgs “-username mrathi –password po1la3r!s”

      These additional parameters are then automatically passed into the script that the Windows service uses to stop the JVM process. As shown in Figure 7, the default is no additional arguments and you can press Enter to skip this option.

      Figure 7. Additional start arguments
      Figure 7. Additional start arguments
    2. Enter the Log Root Path. The default location is specified in Figure 8. You can press Enter to accept the default location, or you can enter the full path to your log root directory.
      Figure 8. Log Root Path
      Figure 8. Log Root Path
    3. Enter the Log File name. The default location is specified in Figure 9. You can press Enter to accept the default location, or you can enter the full path to your log file directory.
      Figure 9. Log File
      Figure 9. Log File
    4. Enter the Config Root location. The default location is specified in Figure 10. You can press Enter to accept the default location, or you can enter the full path to your config root directory.
      Figure 10. Config Root
      Figure 10. Config Root
    5. Specify the restart policy (Figure 11). Enter 1 to automatically restart this service if it fails. Enter 2 to restart manually if the service fails. If you press Enter, the default value of 1 is assumed.
      Figure 11. Restart Policy
      Figure 11. Restart Policy
    6. Specify the Start Type (Figure 12). Enter 1 if you want this service to automatically start when the operating system starts or when the service is called for the first time. Enter 2 if the service must be started manually using the Windows Services panel. The default is 1 (automatic start type).
      Figure 12. Start Type
      Figure 12. Start Type
  7. After all the input prompts the final command is displayed before executing, circled in Figure 13. Review all the parameters in the command before responding to Execute command now?
    Figure 13. Final constructed command
    Figure 13. Final constructed command

A command log is also kept for every command that gets issued. If the command contains a password, the password appears as "*******" in the <WebSphere_Install_Root>\bin\WASServiceCmd.log file. Figure 14 shows an example of what the log file contains.

Figure 14. Example log contents
Figure 14. Example log contents

Conclusion

This article described how you can use the WASServiceCmd utility to guide you through creating, listing, deleting, and tracing Windows services for WebSphere Application Server quickly and without making common errors. This is a great tool for administrators in production environments and in development and test systems where more frequent service creation and deletions might be required.

Resources

Learn

Get products and technologies

Discuss

Comments

developerWorks: Sign in

Required fields are indicated with an asterisk (*).


Need an IBM ID?
Forgot your IBM ID?


Forgot your password?
Change your password

By clicking Submit, you agree to the developerWorks terms of use.

 


The first time you sign into developerWorks, a profile is created for you. Information in your profile (your name, country/region, and company name) is displayed to the public and will accompany any content you post, unless you opt to hide your company name. You may update your IBM account at any time.

All information submitted is secure.

Choose your display name



The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerWorks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

Required fields are indicated with an asterisk (*).

(Must be between 3 – 31 characters.)

By clicking Submit, you agree to the developerWorks terms of use.

 


All information submitted is secure.

Dig deeper into WebSphere on developerWorks


static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=WebSphere
ArticleID=492181
ArticleTitle=The Support Authority: Take the confusion (and errors) out of creating Windows services for WebSphere Application Server
publish-date=05262010