Installing the Standalone Server
The WAR also comes packaged with a standalone server, based on Glassfish V3 Embedded. The quick start is:
Untar the download.
bin/start.sh to start. By default it will listen on port 8080, with JMX listening on port 8081, will have both RESTful and SOAP web services enabled, and will use a sample Ehcache configuration from the WAR module.
bin/stop.sh to stop.
Configuring the Standalone Server
Configuration is by editing the war/web.xml file as per the instructions for the WAR packaging.
Starting and Stopping the Standalone Server
The following describes ways to start and stop the server.
Using Commons Daemon jsvc
jsvc creates a daemon which returns once the service is started. jsvc works on all common Unix-based operating systems including Linux, Solaris and Mac OS X. It creates a pid file in the pid directory. This is a Unix shell script that starts the server as a daemon. To use jsvc you must install the native binary jsvc from the Apache Commons Daemon project. The source for this is distributed in the bin directory as jsvc.tar.gz. Untar it and follow the instructions for building it or download a binary from the Commons Daemon project. Convenience shell scripts are provided as follows:
start -
daemon_start.shstop -
daemon_stop.shjsvc is designed to integrate with Unix System 5 initialization scripts (/etc/rc.d). You can also send Unix signals to it. Meaningful ones for the Ehcache Standalone Server are:
# | Meaning | Effect |
1 | HUP | Restarts the server. |
2 | INT | Interrupts the server. |
9 | KILL | The process is killed. The server is not given a chance to shutdown. |
15 | TERM | Stops the server, giving it a chance to shutdown in an orderly way. |
Executable jar
The server is also packaged as an executable jar for developer convenience which will work on all operating systems. A convenience shell script is provided as follows:
start - startup.sh
From the bin directory you can also invoke the following command directly:
unix - java -jar ../lib/ehcache-standalone-server-0.7.jar 8080 ../war
windows - java -jar ..\lib\ehcache-standalone-server-0.7.jar 8080 ..\war