Configure a JBoss application server to run as an
installed Windows service on a standalone server or a server
cluster.
To configure a JBoss application server to run as a Windows
service:
-
Copy
NEXJ_PLUGIN\core\etc\native\JavaService\lib\platform\JavaService.exe
to JBOSS_HOME\bin.
-
Rename the copied JavaService.exe file to
JBoss.exe.
-
Copy
NEXJ_PLUGIN\core\etc\config\jboss\bin\svc.bat
to JBOSS_HOME\bin.
-
Edit the svc.bat file.
-
Modify the
set SERVICE
line to a desired
unique service name.
For example:
set SERVICE="JBOSS - projectdir"
- Optional:
If multiple JBoss application server instances need to run
concurrently, add or modify the following parameters before the
start
flag in the
JBOSS_BIN
line:
- -Djboss.service.binding.set=ports-0n
- Replace n with a number between 1 and
4 to specify a port offset profile. For example, specify
ports-01 for HTTP port 8180,
ports-02 for HTTP port 8280, and so
on.
- -Djboss.hajndi.port=nnnn
- Use this property to specify the JNDI port of the
server. The value is the combination of the default JNDI
port (1100) and the port offset defined below.
- -Dnexj.port.offset=n00
- Use this property to shift all resource adapter listener
ports. Replace n with a number to specify
a port offset. For example, specify
100 for UDP local port 3101,
200 for UDP local port 3201, and so
on.
Table 1. Port binding chart
Port offset profile |
HTTP port |
HTTPS port |
UPD localPort |
hajndi.port (JBoss 5) |
default |
8080 |
8443 |
3001 |
1100 |
ports-01 |
8180 |
8543 |
3101 |
1200 |
ports-02 |
8280 |
8643 |
3201 |
1300 |
ports-03 |
8380 |
8743 |
3301 |
1400 |
- Optional:
To control memory allocation, add or modify the following
parameters before the
start
flag in the
%JBOSS_BIN%
line:
Table 2. Recommended JVM memory parameter values
Java option description |
Recommended value |
Java option code |
Maximum heap space |
2048 MB |
-Xmx2048m |
Minimum heap space |
2048 MB |
-Xms2048m |
Maximum permanent generation (permgen) space |
256 MB |
-XX:MaxPermSize=256m |
Minimum permanent generation (permgen) space |
256 MB |
-XX:PermSize=256m |
Default stack size |
8192 KB |
-Xss8192k |
Default thread stack size |
8192 KB |
-XX:ThreadStackSize=8192k |
-
Open a command line console and install the service using the
following command:
JBOSS_HOME\bin\svc.bat -i projectdir heap_size multicast_ip partition_name bind_ip
- heap_size
- Specify the heap size value that will be used to define the
maximum and the minimum heap space. For example,
2048.
- multicast_ip
Specify the multicast IP address in the
239.nnn.nnn.nnn
format. For a standalone application, specify an empty string
("").
Use the multicast IP address
to avoid joining the node to other clusters. Replace
nnn with a number between 1 and 255
inclusive. For example, 239.255.16.16. Ensure that the address
does not conflict with the addresses used by other clusters. All
nodes in a cluster must have the same unique IP
address.
- partition_name
- Specify the name of the partition. For a standalone
application, specify an empty string
(""). All nodes in a cluster must have
the same unique partition name.
- bind_ip
- If you want to make the application server accessible from
all network points, specify 0.0.0.0.
For example:
JBOSS_HOME\bin\svc.bat -i projectdir 2048 239.255.16.16 DefaultPartition 0.0.0.0
-
If you are configuring a JBoss application server cluster, for
every node that you plan to include in the cluster, repeat steps 4
to 5.
Edit the svc.bat file to change the
set SERVICE command and then issue an updated
install command.
For example:
JBOSS_HOME\bin\svc.bat -i projectdir2 2048 239.255.16.16 DefaultPartition 0.0.0.0
To run the service, open the Windows services console.
Right-click the service with the name you specified and select
Start. If the installation was successful, the
JBoss application server instance starts up as a Windows service. The
status in the Windows services console changes to "Started".
For
each JBoss application server instance, two log files are stored in the
JBOSS_HOME\server\projectdir\log\
directory: nexj.log and
server.log. The output for these files is configured
in the jboss-log4j.xml file in the
JBOSS_HOME\server\projectdir\conf
directory. The nexj.log file contains NexJ
application information. The server.log file contains
server information.
To uninstall the JBoss application server service, for each JBoss
application server instance enter
JBOSS_HOME\bin\svc.bat -u
projectdir on the command line.