Here is the details to use Java Service Wrapper to make SMSSvr as a
windows service:
1. install SMSLIB AND CONFIGURE SMSSvr.conf file and put it in dist/
classes/org/smslib/smssvr
2. copy log4j-1.2.15.jar to Lib dir
3. copy win32com.dll , comm.jar and javax.comm.properties from
JavaComm to Lib dir
4. copy sqljdbc.jar to Lib dir
5. set JAVA_HOME to your JDK dir in system variables ( i.e : C:\Java
\jdk1.6.0_03)
6. download Java Service Wrapper from :
http://wrapper.tanukisoftware.org/doc/english/introduction.html
7. I used method 1 (
http://wrapper.tanukisoftware.org/doc/english/
integrate-simple-win.html) as follow in summary :
8. First we will copy the following files into the SMSlib Dist\
classes directory:
{WRAPPER_HOME}\bin\Wrapper.exe
{WRAPPER_HOME}\src\bin\App.bat.in
{WRAPPER_HOME}\src\bin\InstallApp-NT.bat.in
{WRAPPER_HOME}\src\bin\UninstallApp-NT.bat.in
9. Rename the three batch files as follows. Be sure to remove the .in
extensions so that the files all end in .bat. Depending on how your
file explorer is configured, you may not be able to see the
extensions.
{ SMSlib _dist}\ classes \ SMSlib.bat
{ SMSlib _dist }\ classes \Install SMSlib -NT.bat
{ SMSlib _dist }\ classes \Uninstall SMSlib -NT.bat
10. The Wrapper.exe file is the actual Wrapper executable. The three
batch files are used to run SMSSvr in a console, and to install and
remove it as an NT Service. These scripts should not require any
modification. They do assume that the wrapper.conf file will be
located within a conf directory one level up, ../conf/wrapper.conf. If
you wish to locate this file someplace else, then the three batch
files will require that small modification.
11. Copy the following two files into the SMSlib lib directory:
{WRAPPER_HOME}\lib\Wrapper.DLL
{WRAPPER_HOME}\lib\wrapper.jar
The Wrapper.DLL file is a native library required by the portion of
the Wrapper which runs within the JVM. The wrapper.jar file contains
all of the Wrapper classes.
12. conf directory
The Wrapper requires a configuration file. The standard location for
this file is in a conf directory in the application's home directory.
SMSlib does not have such a directory by default, so we will need to
create one. Please do so and copy the template wrapper.conf file to
that location:
{WRAPPER_HOME}\src\conf\wrapper.conf.in
Be sure to remove the .in extension so that the file is named
wrapper.conf. Depending on how your file explorer is configured, you
may not be able to see the extension. You should now have:
{ SMSlib_dist }\conf\wrapper.conf
If you wish to relocate the configuration file, you are free to do so.
You will need to modify the batch scripts copied into the bin
directory above, to reflect the new location
13. logs directory:
The default wrapper.conf file will place a wrapper.log file in a logs
directory under the application home directory. SMSlib does not have
such a directory by default, so we will need to create one. Please do
so. You should now have the following directory:
{ SMSlib_dist }\logs
If you wish to place the log file in another location, you will need
to edit the wrapper.conf file and modify the wrapper.logfile property
to reflect the new location
14. Modifying the wrapper.conf File:
This is new wrapper.conf file for SMSSvr to work (you can copy and
replace this with original conf ):
#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
wrapper.java.command=%JAVA_HOME%/bin/java
# Java Main class. This class must implement the WrapperListener
interface
# or guarantee that the WrapperManager class is initialized. Helper
# classes are provided to do this for you. See the Integration
section
# of the documentation for details.
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=../lib/wrapper.jar
wrapper.java.classpath.2=../classes
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib
# Java Additional Parameters
wrapper.java.additional.1=-Dsmssvr.configdir=org/smslib/smssvr/
# Initial Java Heap Size (in MB)
#wrapper.java.initmemory=3
# Maximum Java Heap Size (in MB)
#wrapper.java.maxmemory=64
# Application parameters. Add parameters as needed starting from 1
wrapper.app.parameter.1=org.smslib.smssvr.SMSSvr
#********************************************************************
# Wrapper Logging Properties
#********************************************************************
# Format of output for the console. (See docs for formats)
wrapper.console.format=PM
# Log Level for console output. (See docs for log levels)
wrapper.console.loglevel=INFO
# Log file to use for wrapper output logging.
wrapper.logfile=../logs/wrapper.log
# Format of output for the log file. (See docs for formats)
wrapper.logfile.format=LPTM
# Log Level for log file output. (See docs for log levels)
wrapper.logfile.loglevel=INFO
# Maximum size that the log file will be allowed to grow to before
# the log is rolled. Size is specified in bytes. The default value
# of 0, disables log rolling. May abbreviate with the 'k' (kb) or
# 'm' (mb) suffix. For example: 10m = 10 megabytes.
wrapper.logfile.maxsize=0
# Maximum number of rolled log files which will be allowed before old
# files are deleted. The default value of 0 implies no limit.
wrapper.logfile.maxfiles=0
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper Windows Properties
#********************************************************************
# Title to use when running as a console
wrapper.console.title=sms application server
#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
# using this configuration file has been installed as a service.
# Please uninstall the service before modifying this section. The
# service can then be reinstalled.
# Name of the service
wrapper.ntservice.name=SMSLib
# Display name of the service
wrapper.ntservice.displayname=SMSLib application server
# Description of the service
wrapper.ntservice.description=SMSLib application server
# Service dependencies. Add dependencies as needed starting from 1
wrapper.ntservice.dependency.1=
# Mode in which the service is installed. AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
# Mode in which the service is installed. AUTO_START or DEMAND_START
wrapper.ntservice.starttype=AUTO_START
# Allow the service to interact with the desktop.
wrapper.ntservice.interactive=false
15. Trying It Out
SMSSvr can now be run by simply executing the SMSlib.bat script.
Because of the way the Wrapper sets its current directory, it is not
necessary to run this script from within the dist directory. Please
try running the application once as a console application to verify
the configuration before attempting to run it as a service.
For installing run InstallSMSlib-NT.bat
Then go to services and start it or in cmd : net start SMSLib
To shutdown go to services or in cmd : net stop SMSLib
Congratulations. Your application should now be up and running.
Caution : after installing as service don't edit wrapper.conf . If you
need some change first uninstall the service then edit it