Tomcat5 windows服务不能启动的终极解决方法
2008-07-03 08:52
549 查看
问题所在:
现在很多人都在使用jdk的压缩版,使得tomcat服务不能正确设置java VM,导致tomcat服务不能正常配置和启动。如果你是安装版jdk也出现启动问题,请参照以下方法解决。
假设
jdk 安装目录为 d:/j2sdk
tomcat5 安装目录为 D:/Program Files/Apache Software Foundation/Tomcat 5.0
1. 配置环境变量:
JAVA_HOME = d:/j2sdk
CLASSPATH = %JAVA_HOME%/bin;.;%JAVA_HOME%/lib;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar
CATALINA_HOME = D:/Program Files/Apache Software Foundation/Tomcat 5.0
2. 配置 Tomcat 服务
这里有两种情况,一是tomcat5为安装版,二是解压版,针对这两种情况分别解决。
(1)安装版 tomcat5
在安装时选择安装tomcat服务,如图
安装完成后,打开注册表regedit.exe, 找到HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Tomcat Service Manager/Tomcat5/Parameters,你可以看到里面有很多参数值,主要是修改Java项的值为 d:/j2sdk/jre/bin/server/jvm.dll, 修改正确后,你就可以通过开始->程序->Apache Tomcat 5.0->start tomcat启动服务了。若没有若没有此项,可以依照以下方法设置参数。
(2)解压版 tomcat5
这时你要先配置服务所用的参数,启动命令是 tomcat5的bin目录下的tomcatw.exe(后面附上tomcatw.exe命令参数)。
如果不存在HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Tomcat Service Manager/Tomcat5/Parameters,请先创建,这一步是关键。
使用命令 tomcatw.exe //ES//Tomcat5 打开配置窗口,如下
设置参数如下:
Service栏
Description = Apache Tomcat 5.0 (这个可以随便写)
Image Path = d:/Program Files/Apache Software Foundation/Tomcat 5.0/bin/bootstrap.jar
Work Path = d:/Program Files/Apache Software Foundation/Tomcat 5.0
Auto Start 这个参数允许设置服务为自动启动
Java VM栏:
Auto 不要打勾
Java VM = D:/j2sdk/jre/bin/server/jvm.dll
Java Options = -Dcatalina.home="d:/Program Files/Apache Software Foundation/Tomcat 5.0"
-Djava.endorsed.dirs="d:/Program Files/Apache Software Foundation/Tomcat 5.0/common/endorsed" -Xrs
Start Class = org/apache/catalina/startup/Bootstrap;main;start
Stop Class = org/apache/catalina/startup/Bootstrap;main;stop
Standard Streams:
只要设置两项
Output = d:/Program Files/Apache Software Foundation/Tomcat 5.0/logs/stdout.log
Error = d:/Program Files/Apache Software Foundation/Tomcat 5.0/logs/stderr.log
根据以上设置,接下来可以使用 tomcatw.exe //GT//Tomcat5 启动服务了。
Tomcatw is a GUI application for monitoring and configuring Tomcat services.
The available command line options are:
Command line arguments
Each command line directive is in the form of //XX//ServiceName
The available command line options are:
Command line parameters
Each command parameter is prefixed with --. If the command line is prefixed with ++ then it's value will be appended to the existing option. If the environment variable with the same name as command line parameter but prefixed with
[/code]
Installing services
The safest way to manually install the service is to use the provided service.bat script.
[/code]
[/code]
现在很多人都在使用jdk的压缩版,使得tomcat服务不能正确设置java VM,导致tomcat服务不能正常配置和启动。如果你是安装版jdk也出现启动问题,请参照以下方法解决。
假设
jdk 安装目录为 d:/j2sdk
tomcat5 安装目录为 D:/Program Files/Apache Software Foundation/Tomcat 5.0
1. 配置环境变量:
JAVA_HOME = d:/j2sdk
CLASSPATH = %JAVA_HOME%/bin;.;%JAVA_HOME%/lib;%JAVA_HOME%/lib/dt.jar;%JAVA_HOME%/lib/tools.jar
CATALINA_HOME = D:/Program Files/Apache Software Foundation/Tomcat 5.0
2. 配置 Tomcat 服务
这里有两种情况,一是tomcat5为安装版,二是解压版,针对这两种情况分别解决。
(1)安装版 tomcat5
在安装时选择安装tomcat服务,如图
安装完成后,打开注册表regedit.exe, 找到HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Tomcat Service Manager/Tomcat5/Parameters,你可以看到里面有很多参数值,主要是修改Java项的值为 d:/j2sdk/jre/bin/server/jvm.dll, 修改正确后,你就可以通过开始->程序->Apache Tomcat 5.0->start tomcat启动服务了。若没有若没有此项,可以依照以下方法设置参数。
(2)解压版 tomcat5
这时你要先配置服务所用的参数,启动命令是 tomcat5的bin目录下的tomcatw.exe(后面附上tomcatw.exe命令参数)。
如果不存在HKEY_LOCAL_MACHINE/SOFTWARE/Apache Software Foundation/Tomcat Service Manager/Tomcat5/Parameters,请先创建,这一步是关键。
使用命令 tomcatw.exe //ES//Tomcat5 打开配置窗口,如下
设置参数如下:
Service栏
Description = Apache Tomcat 5.0 (这个可以随便写)
Image Path = d:/Program Files/Apache Software Foundation/Tomcat 5.0/bin/bootstrap.jar
Work Path = d:/Program Files/Apache Software Foundation/Tomcat 5.0
Auto Start 这个参数允许设置服务为自动启动
Java VM栏:
Auto 不要打勾
Java VM = D:/j2sdk/jre/bin/server/jvm.dll
Java Options = -Dcatalina.home="d:/Program Files/Apache Software Foundation/Tomcat 5.0"
-Djava.endorsed.dirs="d:/Program Files/Apache Software Foundation/Tomcat 5.0/common/endorsed" -Xrs
Start Class = org/apache/catalina/startup/Bootstrap;main;start
Stop Class = org/apache/catalina/startup/Bootstrap;main;stop
Standard Streams:
只要设置两项
Output = d:/Program Files/Apache Software Foundation/Tomcat 5.0/logs/stdout.log
Error = d:/Program Files/Apache Software Foundation/Tomcat 5.0/logs/stderr.log
根据以上设置,接下来可以使用 tomcatw.exe //GT//Tomcat5 启动服务了。
TOMCAT5在WINDOWS下的一些命令行
Tomcatw monitor applicationTomcatw is a GUI application for monitoring and configuring Tomcat services.
The available command line options are:
//ES// | Edit service configuration | This is the default operation. It is called if the no option is provided but the executable is renamed to servicenameW.exe |
---|---|---|
//MS// | Monitor service | Put the icon in the system try |
Each command line directive is in the form of //XX//ServiceName
The available command line options are:
//TS// | Run the service as console application | This is the default operation. It is called if the no option is provided. The ServiceName is the name of the executable without exe sufix, meaning Tomcat5 |
---|---|---|
//RS// | Run the service | Called only from ServiceManager |
//SS// | Stop the service | |
//US// | Update service parameters | |
//IS// | Install service | |
//DS// | Delete service | Stops the service if running |
Each command parameter is prefixed with --. If the command line is prefixed with ++ then it's value will be appended to the existing option. If the environment variable with the same name as command line parameter but prefixed with
PR_exists it will take precedence. For example:
set PR_CLASSPATH=xx.jar
is equivalent to providing [code]--Classpath=xx.jar
as command line parameter.
ParameterName | Default | Description |
---|---|---|
--Description | Service name description (maximum 1024 characters) | |
--DisplayName | ServiceName | Service display name |
--Install | procrun.exe //RS//ServiceName | Install image |
--Startup | manual | Service startup mode can be either auto or manual |
--DependsOn | List of services that this service depend on. Dependent services are separated using either # or ; characters | |
--Environment | List of environment variables that will be provided to the service in the form key=value. They are separated using either # or ; characters | |
--User | User account used for running executable. It is used only for StartMode java or exe and enables running applications as service under account without LogonAsService privilege. | |
--Password | Password for user account set by --User parameter | |
--JavaHome | JAVA_HOME | Set a different JAVA_HOME then defined by JAVA_HOME environment variable |
--Jvm | auto | Use either auto or specify the full path to the jvm.dll. You can use the environment variable expansion here. |
--JvmOptions | -Xrs | List of options in the form of -D or -X that will be passed to the JVM. The options are separated using either # or ; characters. |
--Classpath | Set the Java classpath | |
--JvmMs | Initial memory pool size in MB | |
--JvmMx | Maximum memory pool size in MB | |
--JvmSs | Thread stack size in KB | |
--StartImage | Executable that will be run. | |
--StartPath | Working path for the start image executable. | |
--StartClass | Class that will be used for startup. | |
--StartParams | List of parameters that will be passed to either StartImage or StartClass. Parameters are separated using either # or ; character. | |
--StartMethod | Main | Method name if differs then main |
--StartMode | executable | Can one of jvm java or exe |
--StopImage | Executable that will be run on Stop service signal. | |
--StopPath | Working path for the stop image executable. | |
--StopClass | Class that will be used on Stop service signal. | |
--StopParams | List of parameters that will be passed to either StopImage or StopClass. Parameters are separated using either # or ; character. | |
--StopMethod | Main | Method name if differs then main |
--StopMode | executable | Can one of jvm java or exe |
--StopTimeout | No Timeout | Defines the timeout in seconds that procrun waits for service to exit gracefully. |
--LogPath | working path | Defines the path for logging |
--LogPrefix | jakarta_service | Defines the service log filename |
--LogLevel | INFO | Defines the logging level and can be either error, info, warn or debug |
--StdOutput | Redirected stdout filename | |
--StdError | Redirected stderr filename |
[/code]
Installing services
The safest way to manually install the service is to use the provided service.bat script.
Install the service named 'Tomcat5' C:/> service.bat install
If using tomcat.exe, you need to use the //IS// parameter. [code]Install the service named 'Tomcat5' C:/> tomcat5 //IS//Tomcat5 --DisplayName="Apache Tomcat 5" / C:/> --Install="C:/Program Files/Tomcat/bin/tomcat5.exe" --Jvm=auto / C:/> --StartMode=jvm --StopMode=jvm / C:/> --StartClass=org.apache.catalina.startup.Bootstrap --StartParams=start / C:/> --StopClass=org.apache.catalina.startup.Bootstrap --StopParams=stop
Updating services
To update the service parameters, you need to use the //US// parameter. Update the service named 'Tomcat5 C:/> tomcat //US//Tomcat5 --Description="Apache Tomcat Server - http://jakarta.apache.org/tomcat " / C:/> --Startup=auto --Classpath=%JAVA_HOME%/lib/tools.jar;%CATALINA_HOME%/bin/bootstrap.jar
Removing services
To remove the service, you need to use the //DS// parameter. If the service is running it will be stopped and then deleted. Remove the service named 'Tomcat5' C:/> tomcat //DS//Tomcat5
Debugging services
To run the service in console mode, you need to use the //TS// parameter. The service shutdown can be initiated by pressing CTRL+C or CTRL+BREAK. If you rename the tomcat5.exe to testservice.exe then you can just execute the testservice.exe and this command mode will be executed by
Run the service named 'Tomcat5' in console mode C:/> tomcat //TS//Tomcat5 [additional arguments] Or simply execute: C:/> tomcat 安装Tomcat服务的方法 a) %CATALINA_HOME%/bin/tomcat.exe -install "Tomcat5" "%JAVA_HOME%/jre/bin/server/jvm.dll" -Djava.class.path="%CATALINA_HOME%/bin/bootstrap.jar;%JAVA_HOME%/lib/tools.jar" -Dcatalina.home="%CATALINA_HOME%" -Xrs -start org.apache.catalina.startup.Bootstrap -params start -stop org.apache.catalina.startup.Bootstrap -params stop -out "%CATALINA_HOME%/logs/stderr.log" b) %CATALINA_HOME%/bin/tomcat.exe -uninstall -Tomcat5
[/code]
[/code]
相关文章推荐
- Tomcat5 windows服务不能启动的终极解决方法
- windows 无法启动MYSQL服务”1067 进程意外终止”解决的方法——汇总及终极方法
- Oracledbconsole服务不能启动的解决方法
- 解决python写的windows服务不能启动的问题
- Windows下mysql5.7.9解压缩版正确安装步骤,解决win10等windows系统不能启动mysql服务
- vmware虚拟机添加网卡后,RHEL6网络服务不能正常启动解决方法
- Windows服务在Win7中不能安装的解决方法
- 解决Windows 7 系统,Group Policy Client 服务未启动,不能登录的问题。
- 无法启动MYSQL服务”1067 进程意外终止”解决办法——汇总及终极方法
- 无法启动MSMQ服务-安装IIS终极解决方法
- 提示“无法启动 Windows 安全中心服务”的解决方法
- MSMQ无法启动服务-安装WINCC终极解决方法
- tomcat作为windows服务启动失败解决方法
- mysql重装后服务不能启动问题之解决方法
- windows下mysql服务启动"1067进程意外终止"错误解决方法
- 解决python写的windows服务不能启动的问题
- 关于WAMP的Apache服务不能启动的解决方法
- Windows服务在Win7中不能安装的解决方法
- Oracle监听器服务不能启动的解决方法
- 安装Office时出现windows installer服务不能更新一个或多个受保护的windows文件错误的解决方法