Java Service Wrapper

          這個東西我調查了好幾天,累啊不過還是沒有搞得很清楚,不過也有點收獲了

          windows的網絡上很多 ,不多說了,不過conf/wrapper.conf這個文件差不多的


          安裝JDK,。比如你的projecct安裝在/usr/local/myP中。

          使用命令wget Java Service Wrapper(目前版本wrapper-linux-x86-32-3.2.3,官網:http://wrapper.tanukisoftware.org), 用命令tar -zxvc wrapper-linux-x86-32-3.2.3.tar.gz ,得到目wrapper-linux-x86-32-3.2.3,使用ln -s wrapper-linux-x86-32-3.2.3 wrapper wrapper-linux-x86-32-3.2.3 建一個名稱wrapper的快捷方式。

          復制wrapper\src\bin\sh.script.in/usr/local/myP/bin,重命名tomcat

          復制wrapper\src\conf\wrapper.conf.in//usr/local/myP/conf,重命名wrapper.conf

          復制wrapper\src\lib\lib下的所有3個文件到/usr/local/myP/lib

          復制wrapper\bin下的wrapper文件到/usr/local/myP/bin

          修改/usr/local/myP/bin/tomcat文件

          APP_NAME="Servername  "

          APP_LONG_NAME="Servername  Server"

          WRAPPER_CMD="./wrapper"

          WRAPPER_CONF="../conf/wrapper.conf"


          #********************************************************************

          # Wrapper Properties

          #********************************************************************

          # Java Application

          wrapper.java.command=%JAVA_HOME%/bin/java       \\系統需要設定JAVA_HOME


          # 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=../lib/wrappertest.jar

          wrapper.java.classpath.3=../bin/log4j-1.2.8.jar

          wrapper.java.classpath.4=../bin/.

          wrapper.java.classpath.5=../bin/myP.jar   \\需要加載的包,這個包是你需要運行的jar包,是需要加載的


          # Java Library Path (location of Wrapper.DLL or libwrapper.so)

          wrapper.java.library.path.1=../lib


          # Java Additional Parameters

          #wrapper.java.additional.1=


          # 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.client.ProcessMain   \\是需要執行的mian函數(myP.jar )


          #********************************************************************

          # 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=WebAPFWonline Service     \\看英文 名字


          #********************************************************************

          # 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=Servername  \\服務名


          # Display name of the service

          wrapper.ntservice.displayname=Servername Service  \\顯示的服務名


          # Description of the service

          wrapper.ntservice.description=Servername Service  \\服務描述


          # 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


          把ln   -s   /usr/asc/Servername      /etc/init.d    
          注意
          (
          /usr/asc/Servername一定要全路徑,否則是一個復制的是個無效文件)

               /etc/init.d/Appserver     start   這樣就可以了 測試了

          注意:

          如果我把wrapper.java.command=%JAVA_HOME%/bin/java        

          寫成系統jdk的全路徑  /usr/java/jdk/bin/java

          那么         /usr/asc路徑下       運行       ./Appserver       start       是可以的

          其他路徑下       運行       service       Appserver       start       也可以運行.  

          估計service這個命令   不給他指定JAVA_HOME   可能讀不到JAVA_HOME了

          這個我也不太清楚

          service       Appserver       start 會出現
          Unable   to   locate   any   of   the   following   binaries:
              /etc/rc.d/init.d/./wrapper-linux-x86-32
              /etc/rc.d/init.d/./wrapper-linux-x86-64
              /etc/rc.d/init.d/./wrapper  錯誤

          或者無法啟動jvm
          (service       Appserver      console中提示)

          posted on 2009-05-27 19:37 舒阜東 閱讀(1311) 評論(0)  編輯  收藏


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           

          導航

          <2025年7月>
          293012345
          6789101112
          13141516171819
          20212223242526
          272829303112
          3456789

          統計

          常用鏈接

          留言簿

          隨筆檔案

          文章檔案

          51CTO下載(IT技術資料免費下載平臺)

          搜索

          最新評論

          主站蜘蛛池模板: 韶关市| 通河县| 汤阴县| 光泽县| 衢州市| 九台市| 深水埗区| 石屏县| 霍州市| 夹江县| 盐源县| 新龙县| 泽库县| 蛟河市| 南昌县| 姜堰市| 射阳县| 西乌珠穆沁旗| 太和县| 霍邱县| 昔阳县| 剑河县| 蒙阴县| 尤溪县| 辰溪县| 陈巴尔虎旗| 于都县| 台中市| 汶上县| 深州市| 海南省| 磐石市| 封开县| 杭锦旗| 南雄市| 乐昌市| 贡觉县| 库车县| 阜平县| 镇沅| 泽普县|