javaService实现tomcat jboss 注册windows服务
2010-02-24 13:25
351 查看
Example Scripts
As part of the standard JavaService distribution, a number of examplescripts are provided.
These can be used to install and configure the relevant application
software, subject to any
changes required for your specific environment.
These example files are held in the JavaService/scripts sub-directory,
according to wherever you
have unpacked the distribution zip file. The available scripts are as
follows:
InstallOrion.bat / UninstallOrion.bat
Orion Application Server scripts
InstallTomcat.bat / UninstallTomcat.bat
Tomcat service scripts
InstallJBoss.bat / UninstallJBoss.bat
JBoss 3.x Application Server scripts
If you have developed software or scripts so that JavaService can work
with other applications,
it would be appreciated if you could submit these for inclusion in
future releases of this Open Source software.
Orion Application Server Installation
The OrionApplication
Server
is a J2EE-compliant product that runs under the Java run-time
environment. The JavaService
utility provides a convenient mechanism to run this program as an NT
Service.
As the application server requires that an associated database server
is already running, there
is a need to add a Windows NT Service dependency to the Orion Java
Service. The example below
shows how this can be defined, with a dependency on the MySql
database service in this case.
{JDK_HOME} is the location of your JDK and {ORION_HOME} is the
location of your Orion
installation. The administrator username and password fields also
need to be substituted in this command.
Please note that this has been used successfully against the V1.5.2
OrionServer release,
but is in any case provided 'as is'.
Copy the JavaService.exe file into the {ORION_HOME}
directory as OrionServer.exe.
Start a command prompt and change to the directory
{ORION_HOME}.
Run the following command:
OrionServer.exe -install Orion {JDK_HOME}/jre/bin/{hotspot|server|classic}/jvm.dll -Djava.class.path={ORION_HOME}/orion.jar;{JDK_HOME}/lib/tools.jar -Xms64M -Xmx256M -start com.evermind.server.ApplicationServer -stop com.evermind.client.orion.OrionConsoleAdmin -params "ormi://localhost admin_username admin_password -shutdown" -out {ORION_HOME}/log/stdout.log -err {ORION_HOME}/log/stderr.log -current {ORION_HOME} -depends mysql -manual -append -description "Orion Application Server"
To remove the registered service, run the following command
from the same directory:
OrionServer.exe -uninstall Orion
The Orion service can then be started by issuing the following
command,
which will also start the MySql service beforehand if it is not
already running:
net start orion
The Orion service can then be stopped by issuing the following
command:
net stop orion
The MySql database service may be stopped as normal by issuing
the following command:
net start mysql
This will first stop the Orion service, if it is currently running,
following user confirmation.
Tomcat Server Installation
Tomcatis
a JSP engine and was the primary reason that JavaService was
created.
It is a pure Java application that is ideally used as a service,
but comes
with no native ability to do so.
The following example shows how JavaService
can be used to run Tomcat 3.1 as an NT service. The ideas shown
here apply
to using JavaService with any Java application that needs to run
as an
NT service. {JDK_HOME} is the location of your JDK and
{TOMCAT_HOME} is
the location of your Tomcat installation.
Copy the JavaService.exe file into the {TOMCAT_HOME}/bin
directory as tomcat.exe.
Start a command prompt and change to the directory
{TOMCAT_HOME}/bin.
Run the following command:
tomcat.exe -install Tomcat {JDK_HOME}/jre/bin/{hotspot|server|classic}/jvm.dll -Djava.class.path={TOMCAT_HOME}/bin/bootstrap.jar;{TOMCAT_HOME}/bin/servlet.jar;{JDK_HOME}/lib/tools.jar -Dcatalina.home={TOMCAT_HOME} -start org.apache.catalina.startup.Bootstrap -params start -stop org.apache.catalina.startup.Bootstrap -params stop -out {TOMCAT_HOME}/logs/stdout.log -err {TOMCAT_HOME}/logs/stderr.log
JBoss Server Installation
The JBossserver software
provides a Java
run-time environment that can be used for JSP and J2EE applications.
In this use, it often needs to
be run as a Windows NT System Service, for which the JavaService
utility is designed.
Depending on configuration, JBoss may require that an associated
database server is already running, which
should be set up as a Windows NT Service dependency, with the example
below set up against the MySql database.
{JDK_HOME} is the location of your JDK and {JBOSS_BIN} is the
location of your JBoss binaries installation.
These instructions are based on information in the JBoss 3.0
quick-start guide,
but are in any case provided 'as is'.
Copy the JavaService.exe file into the {JBOSS_BIN} directory
as JBossService.exe.
Start a command prompt and change to the directory
{JBOSS_BIN}.
Run the following command:
JBossService.exe -install JBoss {JDK_HOME}/jre/bin/{hotspot|server|classic}/jvm.dll -Djava.class.path={JDK_HOME}/lib/tools.jar;{JBOSS_BIN}/run.jar -start org.jboss.Main -stop org.jboss.Main -method systemExit -out {JBOSS_BIN}/stdout.log -err {JBOSS_BIN}/stderr.log -current {JBOSS_BIN} -depends mysql -manual -overwrite
To remove the registered service, run the following command
from the same directory:
JBossService.exe -uninstall JBoss
The JBoss service can then be started by issuing the following
command,
which will also start the MySql service beforehand if it is not
already running:
net start jboss
The service can then be stopped by issuing the following
command:
net stop jboss
相关文章推荐
- java service wrapper守护进程并注册成windows服务
- 使用javaservice 将jboss 注册为服务
- 徒手用Java来写个Web服务器和框架吧<第三章:Service的实现和注册>
- 使用javaservice 将jboss 注册为服务
- 用jboss native方式代替javaservice.exe来实现jboss在window中的服务自动启动
- 使用javaservice 将jboss 注册为服务
- javaservice wrapper 实现注册服务功能
- Java+Tomcat+MySQL实现简单的网页注册和登录
- JSP+Servlet+Tomcat+Mysql实现用户注册、登陆、修改、添加、查看详情、分页实例之---说明
- 用户注册后,使用激活码的Java实现
- Java用webSocket实现tomcat的日志实时输出到web页面
- JSP+Servlet+Tomcat+Mysql实现注册、登陆、修改、添加、查看、分页实例之----查看单个明细
- Tomcat 或JBOSS java.lang.ArrayIndexOutOfBoundsException: 8192原因及其解决方法
- Java 多线程 BlockingQueue 实现 高并发邮件 代码 SystemEmailServiceImpl
- Tomcat中JAVA定时器实现
- VB.NET客户端调用Axis的Java Web Service实现文件上传
- 运用JAVA的concurrent.ExecutorService线程池实现socket的TCP和UDP连接
- Java实现简易Tomcat服务器(清晰易懂)
- 【转载】使用JAVA在TOMCAT下实现计划任务监听器
- Android(java)学习笔记229:服务(service)之绑定服务调用服务里面的方法 (采用接口隐藏代码内部实现)