2.3.5. Running as a Service under Microsoft Windows
You can configure the server to run as a service under Microsoft Windows, and configure it to start automatically if desired.
There are two ways that the JBoss Enterprise Application Server can be run under Windows.
Unzip the wrapper zip file, and do the following:
copy WRAPPER_HOME\bin\Wrapper.exe %JBOSS_HOME%\bin\Wrapper.exe
copy WRAPPER_HOME\lib\Wrapper.DLL %JBOSS_HOME%\lib\Wrapper.DLL
copy WRAPPER_HOME\lib\wrapper.jar %JBOSS_HOME%\lib\wrapper.jar
mkdir %JBOSS_HOME%\server\YOURCONFIG\wrapper
Create a wrapper.conf
file inside the
%JBOSS_HOME%\server\YOURCONFIG\wrapper
directory, with the below contents:
wrapper.java.command=D:/Java/jdk1.5.0_14/bin/java
wrapper.java.mainclass=org.tanukisoftware.wrapper.WrapperSimpleApp
wrapper.java.classpath.1=%JBOSS_HOME%/lib/wrapper.jar
wrapper.java.classpath.2=%JAVA_HOME%/bin/java/lib/tools.jar
wrapper.java.classpath.3=./run.jar
wrapper.java.library.path.1=%JBOSS_HOME%/lib
# these are the JAVA_OPTS
wrapper.java.additional.1=-server
# enviroment variables - define the ones that match your desired environment
wrapper.java.additional.2=-Denviromnment.variable=value
# memory parameters - define the ones that match your desired environment
wrapper.java.additional.3=-Xms64m
wrapper.java.additional.4=-Xmx96m
# If you need serialization suppport
wrapper.java.additional.5=-Dsession.serialization.jboss=true
wrapper.app.parameter.1=org.jboss.Main
# Parameters to be passed to the application (Jboss)
# Define server name (configuration) - If you need a config that is different than the "default" or need to run multiple configs
wrapper.app.parameter.2=-c YOURCONFIG
# Define listening IP - If you have more than one IP or want to indicate to listen on a specific IP
wrapper.app.parameter.3=-b aaa.bbb.ccc.ddd
# wrapper log location
wrapper.logfile=%JBOSS_HOME%/server/YOURCONFIG/log/wrapper.log
# You must not change below parameters without first uninstall the service
# service name
wrapper.ntservice.name=JbossYOURCONFIG
# service display name
wrapper.ntservice.displayname=JBoss Server YOURCONFIG
The service can be tested by running the following commands:
cd %JBOSS_HOME%\bin\
wrapper.exe -c %JBOSS_HOME%\server\YOURCONFIG\wrapper\wrapper.conf
To now install the service, execute:
cd %JBOSS_HOME%\bin\
wrapper.exe -i %JBOSS_HOME%\server\YOURCONFIG\wrapper\wrapper.conf
If at some point you wish to uninstall the JavaServiceWrapper, execute:
cd %JBOSS_HOME%\bin\
wrapper.exe -r %JBOSS_HOME%\server\YOURCONFIG\wrapper\wrapper.conf
Warning
Make sure your JBOSS_HOME environment variable is set correctly as the wrapper does not set this automatically.
As a final check, make sure that your java-service-wrapper-service.xml
file looks like the following:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE server>
<server>
<mbean code="org.tanukisoftware.wrapper.jmx.WrapperManager"name="JavaServiceWrapper:service=WrapperManager"/>
<mbean code="org.tanukisoftware.wrapper.jmx.WrapperManagerTesting"name="JavaServiceWrapper:service=WrapperManagerTesting"/>
</server>
Note
Using
JavaService is no longer a recommended way to run JBoss as a service on Windows.
JavaService has a bug where it will not pass either Xss or XX:ThreadStackStize? arguemnts to the jvm properly. This results are that each thread stack is 1MB. Under load this will most likely fail with an "java.lang.OutOfMemoryError: unable to create new native thread" error. The fix for this error is to lower the thread stack size. Since JavaService does not allow the thread stack size to be set, there will be no solution once an application has run into this error.
The limit on memory allocation can also cause tiles to slow down in JBoss when many applications are deployed.