Running GlassFish on Mac OS X using launchd

November 6, 2007

I run a Mac Mini as my home server, currently with OS X 10.4. Tonight I dug around and got GlassFish up and running using OS X’s answer to SMF on Solaris, launchd. I am by no means an expert on launchd but I will happily document what worked for me. First off I installed GlassFish v2 to “/usr/local/glassfish” as per the documented instructions.

Once I verified that it all worked, I sought out how to integrate it into launchd. I certainly don’t want it running as root, so I took a look at the available users and groups using the NetInfo Manager application. I found an “appserver” user and associated “appserverusr” group. Seemed a good place to start. I changed the ownership recursively for my install directory to this user and group combination. Once done, I created my launchd plist file and saved it to “/Library/LaunchDaemons/glassfish.plist”.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.sun.glassfish</string>
<key>Disabled</key>
<false/>
<key>UserName</key>
<string>appserver</string>
<key>GroupName</key>
<string>appserverusr</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/glassfish/bin/asadmin</string>
<string>start-domain</string>
<string>domain1</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

Similar to SMF you have to load/import the service description. On OS X you use “launchctl load ./glassfish.plist” for this purpose. If all goes well you will have a running instance of GlassFish. If not, you will see rather vague error messaging in the system.log file.

Some drawbacks. It seems that launchd relies on sending a SIGTERM to the process when you attempt to stop it using “launchctl stop com.sun.glassfish”. This doesn’t work for GlassFish. I prefer the ability of SMF to define a appropriate shutdown command. Not a huge deal as I can easily stop GlassFish using asadmin or the admin console when needed. Once the process is stopped you can use “launchctl start com.sun.glassfish” to bring it back up. There is no notion of a restarter if the process dies. I think there is a new KeepAlive element in OS X 10.5 but I haven’t be able to experiment with that version yet. Sounds promising though.

All in all this works pretty well. GlassFish will launch on boot using the recommended subsystem. If anyone has any tips on achieving a tighter integration with launchd let me know.

Extending the Home Wireless Network

September 9, 2007

I recently picked up a Linksys WRT350N to replace my old WRT54G. After getting the new router up and running, my wife noticed a problem with her Powerbook. It would no longer pick up a strong wireless signal in the sun room. I had hoped the new unit would provide increased range throughout the house but this doesn’t seem to be the case.

I decided to put the old WRT54G back into service and set it up in the sun room as a WDS participant. I flashed both of the units with DD-WRT v24 RC2 and more or less followed this guide. So far it is working great. My wife’s Powerbook went from essentially no signal to four bars. The other benefit is that I can now get my Squeezebox back on the network. Since mine is an older model, it doesn’t support WPA which I am now using for wireless security. The WRT54G is parked right next to the Squeezebox so I am able to connect it wired and get music back in the sun room.

My Headphones, Let Me Show You Them

September 5, 2007

Having a degree from MTSU in audio production, I like things that sound good. Back in college, I bought a pair of Sony MDR-7506 headphones and they remain my favorite to this day. You know they are popular when you can easily buy replacement pads, which I did recently. Not to mention the fact that this model is as readily available as it was in 1996. The thing I think audio geeks like about them is their flat response, very predictable and very detailed.

Who are Genki Rockets?

September 5, 2007

I first heard of Genki Rockets as their track, Heavenly Star, features in the video game, Lumines II. After catching this post on Aeropause, I really think they are marketing a sort of Rei Toei image for the present day.

Flashing the Linksys WRT350N

August 31, 2007

Once Rama posted some favorable results after a recent AirPort upgrade, I decided to drop the cash for a WRT350N of my own. I have been running the home network on a WRT54G v2.2 flashed with a beta of DD-WRT v24. The idea was to migrate to the new hardware using the same software.

After some sleuthing on the interwebs, I discovered that I needed version 1.0 of the WRT350N which is still Broadcom based and supported by DD-WRT. Various folks have reported receiving version 2.0 units which would, for now, keep me tethered to the stock firmware. Either I got lucky or the version 2.0 units just aren’t that prevalent out in the wild because when the friendly UPS truck came, it was indeed bearing a version 1.0 for me.

The initial flashing was rather easy once I booted up Windows on my Mac. Using Firefox or Safari I would get the rather humorous error message, “Upgrade are failed.” This makes me think those Linksys engineers are big fans of Zero Wing. A bit more research revealed that I needed to use IE for the initial flash from the stock Linksys firmware. Granted, it was stated that the OS X version of IE would work but who still uses that?

The new router is now happily running DD-WRT v24 RC1 and most of my settings have been migrated. I haven’t cut over to it yet because that means I have to get under the house. Yep, one of the main reasons for getting this router was the gigabit switch fueled by my grand scheme of running three CAT-5e cables into the sun room. The WRT350N was the last bit I needed and now I have no excuse not to get down into the basement and then into two different crawl spaces to run cable. Well, I guess I can still use spiders as an excuse.

The Drunk Guy Outside Identified

June 25, 2007

I had posted about a lost drunk guy that was lurking outside our home. Well, after eating my lunch one day I thought I would take a walk around the back yard and get some fresh air. I didn’t expect to find a United States Passport lying on the ground beside the house. We looked up the phone number for the address listed and I spoke with his Mom. Her son, the owner of said passport, had recently lost his wallet as well. She gave me his phone number and I gave him a call. I asked him if he knew how his passport had gotten in my back yard. He replied that he had absolutely no idea, but he lives on my block and walked by to pick it up. Yes my friends, I believe this may in fact *be* “Woooo guy.” So I guess you can get so drunk that you can’t find your way home, at least on the first try.

Uber GTI Indeed

May 24, 2007

I have long been a fan of Volkswagen. My Jetta was the first car I bought some seven years ago. Well I have found my next car, though my wife has already said no.

Can you say GTI W12 650!

Urban Farming

April 30, 2007

Inspired by Rama, we have some tomatoes in the ground. Well tomatoes, a red bell pepper plant and two basil plants. This is the first home my wife and I have had with a yard. Not a big yard mind you, since we live in the city, but we do have a handy flower bed that can double for a garden.

Yes the need for weeding never ends. In addition, that line of ground cover and bulbs you see in the back used to extend all the way up to the rock barrier. As one who used to hate yard work when my Dad made me do it, I have found a great deal of enjoyment working outside on the weekends.

Deliver your Green Message the Wrong Way

April 23, 2007

As spotted flying over Nashville.

I took it with my Treo so yeah, the picture is horrible. What you can’t see is an ad that states “Face it coal is filthy.” This is part of a recent campaign to get the word out around colleges about global warming. By the way, that site has problems rendering for me in Firefox. OK, so your plan to make me think about how coal damages our environment is to have an airplane needlessly circle a city for who knows how long? That isn’t what I call leading by example. Well I guess you have to burn fossil fuels to save fossil fuels from burning. Wait what?

Perhaps mobilize your community to get the word out on foot? Maybe even do some printing on recycled paper?

Adobe’s kuler: Community Color Themes

March 26, 2007

I just came across Adobe’s kuler (Flash required) and I love it. What a great idea to share and rate color themes. Having not really had much in the way of color theory training, I will certainly get a lot of use out this site.