java agent注册为windows服务
? ? ? ?我们开发完应用程序一般把JAVA程序和JDK放在一起安装运行,默认是非服务的,在WINDOWS上,基本上是用批处理调用JAR文件来运行的方式,假如是服务端程序,那么这种方式就显得很不雅观,所以有时候需要把JAVA 后台程序注册为WINDOWS服务
?
? ? ? 我们利用APACHE tomcat注册为WINDOWS服务的方式,来为我们的JAVA程序注册成服务,需要的文件有如下目录
?
?
?
?
?
其中LIB里面的3个文件不需要修改,只用放好就可以了,config目录里面的log4j.properties这个根据需哟进行调整,wrapper.conf 是最重要的一个配置文件 ,内容如下
?
配置文件 写道
#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
#wrapper.java.command=java
set.JAVA_HOME=/java/path
wrapper.java.command=..\\jdk1.6.0_10\\jre\\bin\\capaa-pipe-agent
# 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
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperStartStopApp
# 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=../lib/wrappertest.jar
wrapper.java.classpath.3=../auditpipe.jar
wrapper.java.classpath.4=../cutDblink.jar
# Java Library Path (location of Wrapper.DLL or libwrapper.so)
wrapper.java.library.path.1=../lib
# Java Additional Parameters
wrapper.java.additional.1=-Dprogram.name=NB.bat
# 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=com.capaa.pipe.main.AuditMain
wrapper.app.parameter.2=1
wrapper.app.parameter.3=start
wrapper.app.parameter.4=com.Main
#TRUE/FALSE
wrapper.app.parameter.5=TRUE
wrapper.app.parameter.6=1
wrapper.app.parameter.7=stop
#********************************************************************
# 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=../log/hzmc_pipe.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=10m
# 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=1
# Log Level for sys/event log output. (See docs for log levels)
wrapper.syslog.loglevel=NONE
#********************************************************************
# Wrapper NT 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=capaa-pipe-win
# Displ