Nothing too fancy here, but I thought I write down my experiences when installing JBoss on Mac OS 10.5.7. My starting point was the following article from the Apple developer site, but I am having the feeling that those pages are not really up-to-date. Please note that those instructions should only be applied to the “non-server” versions of Mac OS as the server-version has JBoss installed already.
Before any installation the JBoss software needs to be downloaded first. I would say the best starting point for downloading JBoss is here.

I am choosing the most recent stable version, which is at the time of this blog post JBoss 5.0.1.GA. On the following download page I am selecting jboss-5.0.1.GA-jdk6.zip. As typical the file is saved to the Mac OS Download folder. While the download is running it is a good time to start a terminal window as now we get our hands dirty. (I was asking myself if I should explain how to start a terminal window on the Mac, but then I thought that people who do not know that will anyway not survive the rest of these instructions, so I skipped it ;).)
First of all we need a directory to extract the JBoss files in. Thus execute:
bash-3.2$ cd /usr/local
bash-3.2$ sudo mkdir jboss
Your prompt might look different and you need to give your superuser password when executing the mkdir-command. This password should be the one you are using when logging in to your Mac.
Once the download is finished we copy the downloaded file to the newly created directory and extract it there. Of course the path to the downloaded file will vary as you have to give your own user name there instead of mine. Afterwards we are cleaning up by removing the ZIP-file again as it was anyway only a copy from the download-folder.
bash-3.2$ cd /usr/local/jboss
bash-3.2$ sudo cp /Users/thomasjaspers/Downloads/jboss-5.0.1.GA-jdk6.zip .
bash-3.2$ sudo unzip /Users/thomasjaspers/Downloads/jboss-5.0.1.GA-jdk6.zip
bash-3.2$ sudo rm jboss-5.0.1.GA-jdk6.zip
Ok, in principle nothing should prevent us now from starting up the JBoss server right away. So let’s give it a try:
bash-3.2$ cd /usr/local/jboss/jboss-5.0.1.GA/bin
bash-3.2$ sudo ./run.sh
The following error is not really nice, but does not look too severe:
./run.sh: line 89: ulimit: open files: cannot modify limit: Invalid argument
run.sh: Could not set maximum file descriptor limit: unlimited
But the following exception does not look too promising and definitly needs some attention:
21:35:29,286 WARN [ClassLoaderManager] Unexpected error during load of:org.jboss.resource.metadata.repository.DefaultJCAMetaDataRepository
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:675)
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:63)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:546)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:506)
The “jdk6″ in the name of the JBoss ZIP-file might be a good hint here already as executing “java -version” shows that I am only running Java 1.5 still:
java version “1.5.0_16″
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)
It seems to be time for some update so I am downloading Java SE6 for Mac OS from the Apple Support Pages. As this is downloaded as an Mac OS DMG package the installation can be done straightforward by opening the downloaded file. Unfortunetly this does not do the complete job as afterwards still the previous Java version is set to be the default one. So we need to take a closer look into this directory: /System/Library/Frameworks/JavaVM.framework/Versions
Here we can see that the softlink for the “Current” version still points to some old Java release.
lrwxr-xr-x 1 root wheel 5 5 Okt 2008 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 14 Jan 2008 1.3.1
lrwxr-xr-x 1 root wheel 5 5 Okt 2008 1.4 -> 1.4.2
lrwxr-xr-x 1 root wheel 3 11 Sep 2008 1.4.1 -> 1.4
drwxr-xr-x 8 root wheel 272 21 Feb 2008 1.4.2
lrwxr-xr-x 1 root wheel 5 5 Okt 2008 1.5 -> 1.5.0
drwxr-xr-x 8 root wheel 272 21 Feb 2008 1.5.0
lrwxr-xr-x 1 root wheel 5 5 Okt 2008 1.6 -> 1.6.0
drwxr-xr-x 8 root wheel 272 11 Sep 2008 1.6.0
drwxr-xr-x 8 root wheel 272 5 Okt 2008 A
lrwxr-xr-x 1 root wheel 1 5 Okt 2008 Current -> A
lrwxr-xr-x 1 root wheel 3 5 Okt 2008 CurrentJDK -> 1.5
So let’s change this one and check again:
bash-3.2$ sudo rm Current
bash-3.2$ sudo ln -s 1.6.0 Current
bash-3.2$ java -version
And now we are getting what we want:
Java version “1.6.0_07″
Java(TM) SE Runtime Environment (build 1.6.0_07-b06-153)
Java HotSpot(TM) 64-Bit Server VM (build 1.6.0_07-b06-57, mixed mode)
With this it is time to give the JBoss startup another try … and now the startup works nicely without any Java exceptions and we see the server running like a charm :):
But there is still the other problem left, as it is simply not nice that the system is complaining on every startup on this: “/run.sh: line 89: ulimit: open files: cannot modify limit: Invalid argument”. So let’s have a look at the run.sh file, for example by opening it in “vi” and enabling line numbers with the command “:set number”. When printing out the value of the variable $MAX_FD it becomes visible that it contains “unlimited”, which does simply not work. As it is late and I am a little bit lazy I am just replacing this one hardcoded with some maximum value, which I am setting to 10240. This should be more than enough for some local testing and playing around. (I will not use JBoss productive on my MacBook Pro I guess ;).) So just change line 89 as follows:
old: ulimit -n $MAX_FD
new: ulimit -n 10240
And then start the JBoss application server again. The error message should be vanished. Please note that this is not the nicest possible solution for this problem and it would be of course much better defining some environment variable and using it there, but did I mention already that I am too lazy now for this?
Of course we need some final proof that the JBoss-server is really running for you disbelievers out there. Therefore please open the following web page in your browser and enjoy: http://localhost:8080/

Next time we will integrate some local MySQL database to the server by adding the corresponding data source, but now it is time to get some sleep as there is some real work to do tomorrow :).