Running JBoss
Choose a Mode
The JBoss
installation on our Pi offers a couple of different configurations out of the
box.
The first
choice to be taken is whether to start JBoss in standalone or domain mode.
Doman mode
is a special management mode which we might inspect later. For now we will set
off in standalone mode. This just means we will have to configure each instance
individually. We can still cluster our standalone instances and even go for
high availability in standalone mode.
Choose a Configuration
All the scripts
for starting JBoss are located in JBOSS_HOME/bin.
JBoss is
started in standalone mode by running standalone.sh:
standalone.sh
Without any
parameters, standalone.sh will use the configuration defined in standalone.xml,
located in JBOSS_HOME/standalone/configuration directory.
You can
choose another configuration by specifying it on the command line:
standalone.sh
–server-config=standalone-full.xml
JBoss and Java
Standalone.sh
inspects first JAVA then JAVA_HOME environment variable for a hint, where java
is installed. If both variables are not set, JAVA is simply set to java which
means the PATH variable determines if and where Java will be found.
And it will
be found like this:
- We find /usr/bin in our classpath (verify
by typing $PATH on a Pi console)
- /usr/bin contains “java”
- Java is a softlink into alternatives (/etc/alternatives/java)
- Following this link, we find: java ->
/usr/lib/jvm/java-7-openjdk-armel/jre/bin/java
And that is
what we get when we run Java on the Pi.
Everything
depends on soft links and the alternatives concept. This makes it very easy to
switch to another Java installation in the future.
To make a
long story short, leave everything as it is.
Making JBoss available within Your Network
All my Pis
have static IP addresses within my private network. This can be configured
within your router.
If you want
to be able to reach a JBoss instance running on a Pi, you have to configure
JBoss’ “Public Interface”.
This
configuration is done standalone.xml located in
/JBOSS_HOME/standalone/configuration.
Find the
interfaces section and edit the public and the management interface like this:
<interfaces>
<interface name="management">
<inet-address
value="xxx.xxx.xxx.xxx"/>
</interface>
<interface name="public">
<inet-address
value="xxx.xxx.xxx.xxx"/>
</interface>
…
</interfaces>
Where xxx.xxx.xxx.xxx
is the IP you configured in your rooter for this specific Pi.
Save the
changes.
Create JBoss Users
In order to
access JBoss’ admin console, we need to create a management-realm user.
This is
done by running the add-user.sh script located in /JBOSS_HOME/bin directory.
Be sure to select management realm.
For later
use, we create an application-realm user.
For now,
assign the guest role to this user.
Starting JBoss
Let’s give
JBoss a test run.
Switch to /JBOSS_HOME/bin
and run standalone.sh in a Pi terminal window:
sh
standalone.sh
When JBoss
is up, you can access the web-server from any client within your network.
If you
assigned a name to your Pi within your router, you can use this name to access
the Pi. If not, use the Pi’s IP address.
Stopping JBoss
The best
way to stop JBoss is by using the CLI.
Open another
terminal session on the Pi and switch to /JBOSS_HOME/bin.
Run
jboss-cli.sh
The CLI
starts in “disconnected” mode, so you have to connect.
Type
connect xxx.xxx.xxx.xxx (IP address of your Pi)
When
connected successfully, enter
:shutdown
JBoss will
shut down and you can exit the terminal session.
Summary
Now we have Java and JBoss installed on our Pi(s).
JBoss is now accessible from anywhere within our network.
We created a management-user and an application-user.
We can start and stop JBoss on the Pi and have access to its management
console.
In the next post we will develop our first JEE application and deploy it
to the Pi.
See you then…
nice post
ReplyDeletethank you :-)
ReplyDelete