Keeping it Small and Simple

2008.03.02

JBoss on Debian quickstart

Filed under: jboss — Tags: , , , — Lorenzo E. Danielsson @ 22:59

I frequently get asked about setting up and using JBoss, so I thought I’d write a bit about it, just in case it helps anybody out there. In this first post I’ll just show you how to get JBoss AS up and running. In later posts I’ll get into more details, and show you how to set up things like JBoss Portal. I’m doing this on a Debian Etch system, but the instructions should more or less apply across Linux/UNIX systems.

What about JBoss in the Debian repositories?

If you feel like giving it a try do:

# aptitude install jbossas4

But, it won’t do much (at least they didn’t last time I tried). The JBoss packages in Debian need some work before they become usable. (I’m not sure about the status in Sid.)

Downloading

Before you do anything else, you need to have Java installed. I’m using Sun’s JDK 6, and that seems to work fine. JDK5 should also work.

Go here and grab a copy of JBoss AS. Latest stable at this time of writing is 4.2.2 GA. (I’ll probably do a post on JBoss 5 at some point.) When you get to the Sourceforge page, make sure you grab the correct package. The packages with src in their names are source packages. Only download them if you want to compile JBoss yourself. I will assume you don’t.

Installing

Once you have downloaded JBoss AS, you need to extract it. I chose to do so into /opt. The following needs to be done as root:

# cd /opt
# unzip /home/lorenzod/dl/jboss-4.2.2.GA.zip

After a few seconds it should be done, and ls will show you that there is a new directory called jboss-4.2.2.GA. If you want you can change the name of the directory to jboss, jboss4 or whatever makes you happy. I’ll keep the name as it is.

Testing the server

To make sure everything is fine up to this point, let’s try to start the server.

# cd /opt/jboss-4.2.2.GA
# bin/run.sh

You should see loads of log messages flying by in your terminal. That is normal. Eventually you will see a message like this:

22:31:21,073 INFO  [Server] JBoss (MX MicroKernel) [4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA date=200710221139)] Started in 14s:615ms

Note that by default JBoss will only listen on 127.0.0.1 (localhost), which means it’s only accessible from the computer you are running JBoss on. To make it listen to other interfaces as well restart the server like this (you can press CTRL+C to stop JBoss if it s running):

# cd /opt/jboss-4.2.2.GA
# bin/run.sh -b 0.0.0.0

This will make JBoss listen on all the network interfaces. If you only want it to listen on a specific interface, use that IP address after the -b, for example bin/run.sh -b 192.168.0.5 will make JBoss only listen on the IP address 192.168.0.5.

Next, open a browser. If your browser is on the same machine as JBoss AS, you can browse to http://localhost:8080. Otherwise you’ll have to use either the name of the machine or its IP address. I’ve got JBoss running on 192.168.0.5 and that machine is known as devel in our local DNS, so I can access JBoss as by either http://192.168.0.5:8080 or http://devel:8080.

If you get a page server by JBoss then everything is working. Otherwise, you will have to go back and make sure you didn’t leave something out.

Other

Eventually, you will want to add something like this into your ~/.zshrc (or whichever start-up files your $SHELL uses):

export JBOSS_HOME=/opt/jboss-4.2.2.GA

IIRC, the JBoss documentation also suggests you add $JBOSS_HOME/bin to your PATH. I don’t personally do that because the names of the scripts in that directory are too generic (run.sh, shutdown.sh etc). But if you like you can do this somewhere (~/.zshenv is a good idea):

path=($path $JBOSS_HOME/bin)

Obviously you would have to set JBOSS_HOME before this is executed, otherwise you’ll have problems. You might want to rename the scripts to jboss-run.sh, jboss-shutdown.sh, etc.

Conclusion

I have shown how to install JBoss and get it up an running. It won’t start automatically when you boot the server yet. You will need an init script for that. I will get to that soon.

Note that there isn’t all that much interesting you can do with the application server yet. In order to make it more interesting you will need to develop some applications for it, or install some existing ones. Next time, I’ll look at how to set up JBoss Portal.

5 Comments »

  1. These were very clear instructions and worked beautifully. Thanks!

    Comment by joonspoon — 2008.03.17 @ 20:47

  2. Thank you for this guide! It worked fine for me!
    As our friend said in the message before. These were very clear instructions!

    Thank you!

    Comment by Gustavo — 2008.04.07 @ 13:06

  3. Thanks guys. I wanted to provide a very simple way to get started with JBoss. Your comments indicate that I did just that.

    Comment by Lorenzo E. Danielsson — 2008.04.07 @ 22:05

  4. I installed JBoss in my Ubunutu and I work in Netbeans… but this message appear when i try to run the jboss:

    INFO [TomcatDeployer] deploy, ctxPath=/, warUrl=…/deploy/jboss-web.deployer/ROOT.war/

    11:55:15,896 ERROR [[/]] Error configurando escuchador de aplicación de clase com.sun.rave.web.ui.appbase.servlet.LifecycleListener

    java.lang.ClassNotFoundException: com.sun.rave.web.ui.appbase.servlet.LifecycleListener

    at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

    what s this?? how can I resolve it?…

    thanks!

    Comment by Mines — 2008.07.23 @ 18:55

  5. please if you have any solution about it send me a mail to lamaru86@gmail.com .I m desesperaateeeeeeeeeeeeeeeeeeeed!! 😥

    Thanks for read my failures :s

    Comment by Mines — 2008.07.25 @ 12:40


RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.