Windows Service

jWebSocket Server as Windows Service

Windows Service

Hot News
Now available in 32 bit and 64 bit
– reduced size, shared libraries, configurable
– new log files and folder structure

jWebSocket Server as Windows Service

This section describes how to set up the jWebSocket Server so that it runs as a Windows Service, e.g. on a Windows 2003 or 2008 Server. It was also tested on both 32bit and 64bit versions of Windows XP and Windows 7. This topic will be interesting for you when you intend to run the jWebSocket Server on a dedicated production system.

Although it might look simple to run the jWebSocketServer32/64-<version>.exe as a stand-alone server by simply double-clicking it or putting a short-cut to it into the Windows auto-start group, a drawback is that normal desktop applications are terminated when you log off the system. Unlike usual applications, services remain running in the background even when you log off. Thus on a desktop "server" you need to remain logged in to run the jWebSocket Server which, of course, is not recommended due to security and reliability reasons.

To run the jWebSocket server without being logged in you either can run it as a Windows service by using the jWebSocketService32/64-<version>.exe (described below) or alternatively embed it into a web application which is described here.

Prerequisites

Before you run the jWebSocket Windows Executable please ensure that you have a working jWebSocket Server installation as described here.

Installing and Uninstalling the jWebSocket Service

To run the jWebSocket Server as a Windows Service please follow the following steps.

  1. Depending on the processor architecture of your system either download the jWebSocketService32-<version>.zip or jWebSocketService64-<version>.zip from bundles section in the download area.
  2. Unpack the .zip archive with the jWebSocketService32/64-<version>.exe into the /bin folder of your existing jWebSocket installation (e.g. c:\program files\jWebSocket-<version>\bin).
  3. Change to that folder and run jWebSocketInstallService32/64-<version>.bat to register the jWebSocketService32/64-<version>.exe as a Windows service.
  4. Check if the service has been properly installed in the Windows Service Manager (select Start/Administrative Tools/Services).
  5. Right-click the jWebSocket Service entry and select Start.
  6. The service starts and the jWebSocket Service is available.
  7. When you re-start the system the jWebSocket Service will be started automatically. Start the jWebSocket Server as a Windows service
  8. To uninstall the jWebSocket Service you run jWebSocketUninstallService32/64-<version>.bat After uninstalling the service the jWebSocket Server cannot be used anymore as Windows service, however, the command line .jar versions and executables will still be available and working.
  9. Because the jWebSocket Windows Services do not open a console window the log output should be written to the jWebSocket.log file in the /logs folder below the jWebSocket root. To configure this please update the log4j.xml file in the /conf folder accordingly by following its inline comments.

Tips and Tricks

In case you get an error message like "Could not open SCManager." during the installation of the Windows Service this might be related to missing access rights or due to too restrictive User Access Control (UAC) settings.

In the console you can type:

runas /profile /user:administrator
  jWebSocketInstallService32/64-<version>.bat

to run the service installer as Administrator.

Publications

Learn more about WebSockets in general, get background information and gain deeper insight!

Join jWebSocket

Wether developer, designer or translator – join the jWebSocket team and grow together with our success!

Copyright © 2013 Innotrade GmbH. All rights reserved.