Las visitas de hoy a la página: 47
This page validates as XHTML 1.0, and will look much better in a browser that supports web standards, but it is accessible to any browser or Internet device. It was created using techniques detailed at glish.com/css/.
En estos momentos, me encuentro estudiando EJB's por eso me surgió la necesidad de ejecutar JBoss en mi equipo.
No era nada practico para mi iniciarlo desde la línea de comandos cada vez que lo ocupaba, asi que me le pregunte a mi gurú como podria iniciar JBoss como un servicio de Windows.
Encontre dos opciones:
De estas dos, me decidi por Java Service Wrapper, el proceso para iniciar JBoss como un servicio a continuacion:
{WRAPPER_HOME}\bin\Wrapper.exe
{WRAPPER_HOME}\src\bin\App.bat.in
{WRAPPER_HOME}\src\bin\InstallApp-NT.bat.in
{WRAPPER_HOME}\src\bin\UninstallApp-NT.bat.in
{JBOSS_HOME}\bin\JBoss.bat
{JBOSS_HOME}\bin\InstallJBoss-NT.bat
{JBOSS_HOME}\bin\UninstallJBoss-NT.bat
@echo off @echo off rem rem Find the application home. rem if "%OS%"=="Windows_NT" goto nt echo This is not NT, so please edit this echo script and set _APP_HOME manually set _APP_HOME=.. goto conf :nt rem %~dp0 is name of current script under NT set _APP_HOME=%~dp0 rem : operator works similar to make : operator set _APP_HOME=%_APP_HOME:\bin\=% rem rem Find the wrapper.conf rem :conf set _WRAPPER_CONF="%~f1" if not %_WRAPPER_CONF%=="" goto startup set _WRAPPER_CONF="%_APP_HOME%\conf\wrapper.conf" rem rem Run the application. rem At runtime, the current directory will be that of Wrapper.exe rem :startup "%_APP_HOME%\bin\Wrapper.exe" -c %_WRAPPER_CONF% if not errorlevel 1 goto end pause :end set _APP_HOME= set _WRAPPER_CONF=
#********************************************************************
# Wrapper Properties
#********************************************************************
# Java Application
wrapper.java.command=%JAVA_HOME%\bin\java
# 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=%JBOSS_HOME%\lib\wrapper.jar
wrapper.java.classpath.2=%JAVA_HOME%\lib\tools.jar
wrapper.java.classpath.3=%JBOSS_HOME%\bin\run.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=run.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=org.jboss.Main
wrapper.app.parameter.2=-c # Tipo de servidor
wrapper.app.parameter.3=all # En este caso se usa el completo, opcion "all"
# se puede usar "default" o "minimal"
#********************************************************************
# 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 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=JBoss
# Display name of the service
wrapper.ntservice.displayname=JBoss Application Server
# Description of the service
wrapper.ntservice.description=JBoss Application Server
# 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
{WRAPPER_HOME}\lib\Wrapper.DLL
{WRAPPER_HOME}\lib\wrapper.jar
Con eso bastaria para iniciar para hacer una prueba. Esta consiste en ejecutar el archivo {JBOSS_HOME}\bin\JBoss.bat, con la finalidad de detectar algun error en la configuracion del Wrapper. La salida de la consola de las ultimas dos lineas, debe ser algo parecido a esto:
jvm 1 | 21:01:55,340 INFO [Server] JBoss (MX MicroKernel) [3.2.3 (build: CVS Tag=JBoss_3_2_3 date=200311301445)] Started in 44s:781ms
Para detener JBoss, desde otra consola, tecleamos {JBOSS_HOME}\bin\shutdown.bat -S.
Si no tuvimos problemas, ejecutamos el archivo {JBOSS_HOME}\bin\InstallJBoss-NT.bat, obtendremos algo como esto:
C:\jboss-3.2.3\bin>InstallJBoss-NT.bat wrapper | JBoss Application Server installed. C:\jboss-3.2.3\bin>
Con esto ya no debemos preocuparnos por iniciar JBoss cada vez que tengamos que usarlo, ahora correra como un servicio de Windows. Ya solo bastara abrir la consola de Servicios de Windows e iniciar JBoss.
Echen un vistazo:
Si deseamos remover el servicio, ejecutamos {JBOSS_HOME}\bin\UninstallJBoss-NT.bat
Practico ¿no?
Linderel, habia hecho algo similar...
Por cierto, la instancia de JBoss ejecutandose, consumira los 64 MB que le indicamos al archivo de configuración. Obviamente se pueden establecer parametros diferentes, pero como comentaba usuariox, suele ser un poco doloroso tenerlos apartados para un solo proceso...
Hasta la otra.