下午在客戶那邊要把Tomcat 裝成service。一般情況是在用command line在tomcat/bin下
service.bat install
就可以安裝成服務。不過下午這樣裝,安裝成Windows服務都無法啟動,可是開Console卻很正常,在jakarta_service的log中出現下列錯誤:
[2011-01-25 16:34:24] [info] Procrun (2.0.4.0) started
[2011-01-25 16:34:24] [info] Running Service…
[2011-01-25 16:34:24] [info] Starting service…
[2011-01-25 16:34:24] [174 javajni.c] [error] 找不到指定的模組。
[2011-01-25 16:34:24] [994 prunsrv.c] [error] Failed creating java C:Javajre6binclientjvm.dll
[2011-01-25 16:34:24] [1269 prunsrv.c] [error] ServiceStart returned 1
[2011-01-25 16:34:24] [info] Run service finished.
[2011-01-25 16:34:24] [info] Procrun finished.
或是
[2011-01-25 15:58:32] [info] Procrun (2.0.4.0) started
[2011-01-25 15:58:32] [info] Running Service…
[2011-01-25 15:58:32] [info] Starting service…
[2011-01-25 15:58:32] [174 javajni.c] [error] %1 不是正確的 Win32 應用程式 。
[2011-01-25 15:58:32] [994 prunsrv.c] [error] Failed creating java C:Javajdk1.6.0_23jrebinserverjvm.dll
[2011-01-25 15:58:32] [1269 prunsrv.c] [error] ServiceStart returned 1
[2011-01-25 15:58:32] [info] Run service finished.
[2011-01-25 15:58:32] [info] Procrun finished.
[2011-01-25 15:58:50] [info] Procrun (2.0.4.0) started
[2011-01-25 15:58:50] [info] Running Service…
[2011-01-25 15:58:50] [info] Starting service…
[2011-01-25 15:58:50] [994 prunsrv.c] [error] Failed creating java
[2011-01-25 15:58:50] [1269 prunsrv.c] [error] ServiceStart returned 1
[2011-01-25 15:58:50] [info] Run service finished.
[2011-01-25 15:58:50] [info] Procrun finished.
google到的辦法都是要我重裝x64的JDK,可是這一點早就確認了。但是一直還是無法啟動。後來發現,原來我的tomcat是用zip包不是用installer,因此tomcat5.exe還有tomcat5w.exe是x86編譯的(32位元),因此要自己去tomcat的SVN上找到相對應版本的tomcat5.exe、tomcat5w.exe (或tomcat6.exe tomcat6w.exe)。
tomcat的SVN在這: http://svn.apache.org/viewvc/tomcat/
例如我下載5.5.27版的就在這: http://svn.apache.org/viewvc/tomcat/tc5.5.x/tags/TOMCAT_5_5_27/connectors/procrun/bin/amd64/
但是Stack Overflow裡面tomcat6的路徑是放在: http://svn.apache.org/viewvc/tomcat/tc6.0.x/tags/TOMCAT_6_0_16/res/procrun/amd64/
結構有點不大一樣,總之先到這找到適用的版本,然後找到procrun這個目錄,然後再找amd64 (也就是x64)的版本,下載完後將原本的exe覆蓋。然後再重新安裝service就可以了。
參考: