JBoss 4 Application Server & FreeBSD 6

jboss-4-application-server-freebsd-6

At work, we currently have deployed apps that run on JBoss under Windows 2003. No big deal really, apart from other services on the Windows servers tend to kill the entire box now and again - quite a pain in the backside. So I’m trying to convince them to move to a more stable OS, that being FreeBSD.

I documented the whole thing (as you should), so here is my guide to installing and configuing JBoss4 on a fresh install of FreeBSD :-) Before we start, we’d better check we have all the requirements:

  • FreeBSD 6.2 installed and ready to rock
  • A root login account
  • SFTP / FTP access to the server

First we’d better update our ports quickly. We need to make sure we’re getting the most up to date sources:

portsnap fetch
portsnap update

Obviously JBoss is a Java application server, so common sense would say we need to install Java first.  According to RedHat, the latest JBoss releases (4.2) only need the JRE (runtime environment) to run, but on FreeBSD that isn’t the case - it still wants to JDK (development kit) so lets install that:

cd /usr/ports/java/diablo-jdk15 && make install clean

But you’ll find that complains:

 ===>  diablo-jdk-1.5.0.07.01_7 :
Because of licensing restrictions, you must fetch the distribution
manually.
Please access

http://www.FreeBSDFoundation.org/cgi-bin/download?download=diablo-caffe-freebsd6-i386-

1.5.0_07-b01.tar.bz2

with a web browser and “Accept” the End User License Agreement for
“Caffe Diablo 1.5.0″.  Please place the downloaded
diablo-caffe-freebsd6-i386-1.5.0_07-b01.tar.bz2 in /usr/ports/distfiles.

Please open http://java.sun.com/javase/downloads/index.jsp
in a web browser and follow the “Download” link for
“JDK US DST Timezone Update Tool - 1.2.2″ to obtain the
time zone update file, tzupdater-1_2_2-2007g.zip.

.*** Error code 1

Stop in /usr/ports/java/diablo-jdk15.

Ok, so we need to get the files manually.  The first file is easy to pick up.  The Timezone update is not as you are forced to register an account with Sun.  No biggie really, just a bit of a pain.

FTP/SFTP these two files to your /usr/ports/distfiles and we’re ready to continue:

 cd /usr/ports/java/diablo-jdk15 && make install clean

Make sure you enable the TZUPDATE option.  This took about 15 minutes on my box, but might take longer on yours.  Go get something to eat or get a coffee.

If that suceeded, then you’re already half way there!  Now it’s time to actually install JBoss itself……

 cd /usr/ports/java/jboss4 && make install clean

Wait for that to build.

There’s a couple of configuration changes you’ll need to make if you want it to a.Work b.Work on the network.

Edit /usr/local/jboss4/bin/run.conf and setup the JAVA_HOME variable to equal “/usr/local/diablo-jdk1.5.0/” so it can find Java where FreeBSD installs it.  In this file you can also add extra classpaths, configure memory allocations etc.

Out of the box, JBoss uses port 8080.  To change that, edit the file  /usr/local/jboss4/server/default/deploy/http-invoker.sar/META-INF/jboss-service.xml
Search for 8080 and replace it with whatever port number you want to use.

Starting JBoss is simple:

/usr/local/jboss4/bin/run.sh

Starting JBoss binded to an ip other that 127.0.0.1 is simple also:

/usr/local/jboss4/bin/run.sh -b 192.168.0.1 (or whatever ip you’re using)

5 Responses

  1. etienne Says:

    Hi,

    I have got a question regarding the installation of the jboss app server.

    Why did you choose the diable-sdk instead of the /java/jdk15 port?

    TIA,
    Etienne.

  2. pc Says:

    Hi Etienne,
    1)read first page at http://www.freebsdfoundation.org/downloads/java.shtml

    2)jboss depends on diablo-jdk http://www.freshports.org/java/jboss5/

  3. vinayak Says:

    Nice article ..

    Thank you very much…

  4. Marco Says:

    Thanks for give the steps. That worked fine for me. But still 3 doubts remain: having JBoss up on FreeBSD and having the server being visible from another PC on the same LAN (just typping :8080 on any web browser)…

    1) WHAT FOLDER USES JBOSS ON FREEBSD IN ORDER TO EXECUTE THE WAR FILES? (or more exactly, in what folder must i paste the .WAR file so that may be executed by JBoss on FreeBSD)

    2) DO I HAVE TO EDIT ANY JBOSS’S CONFIGURATION FILE(S) IN ORDER TO MAKE THE .WAR VISIBLE ON INTERNET?

    3) I MADE THE .WAR APPLICATION ON NETBEANS FOR WINDOWS, WITH .JAVA CLASSES AND JSPs. I KNOW THAT JAVA CLASSES AND JSPs MAY BE EXECUTED ANYWHERE BUT STILL CAN I EXECUTE THE .WAR ON FREEBSD WITH THE GIVEN CONDITIONS SO FAR?

    Thanks in advance for the answers and examples if necessary. And sorry for my english if i said something wrong. I am from Chile and there we speak spanish ^^.

    Thanks. :D

  5. james Says:

    Your WAR needs to go into the $JBOSS_HOME$/server/default/deploy directory. You don’t need to edit any config for the application to be deployed and visible, just browse the server:8080/yourAppName and you’ll see it.

    Java is Java and will run on any platform where the correct version of the JRE is installed. Doesn’t matter if you develop on Windows or Linux or OS X, you can deploy on any other Java platform.

Leave a Comment

Please note: Comment moderation is enabled and may delay your comment. There is no need to resubmit your comment.