Running JBossAS7 as a daemon on MacOS X Lion

JBossAS7 has such a small resource footprint that I can’t think of any good reason not to just have it running all the time as a background daemon. And it saves me having to have a terminal instance open to run it in. So I added it to my user launchd configuration.

To do this:

  1. Create a launchd plist file. This file contains the configuration that is used to launch and handle the AS7 process. Here is the file I am using. I saved it as jboss.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>jboss</string>
    
          <key>Disabled</key>
          <false/>
    
          <key>KeepAlive</key>
          <dict>
             <key>SuccessfulExit</key>
             <false/>
          </dict>
    
          <key>Program</key>
          <string>/Users/tabby/Library/jboss-as-7.1.1.Final/bin/standalone.sh</string>
    
          <key>StandardOutPath</key>
          <string>/Users/tabby/Library/jboss-as-7.1.1.Final/out.log</string>
    
          <key>RunAtLoad</key>
          <true/>
    
          <key>UserName</key>
          <string>tabby</string>
       </dict>
    </plist>

    Program is the command that will be used to launch the process, so either standalone.sh or domain.sh. I don’t if there is any trick if you want to supply command line parameters – exercise for the student ;-) .

    StandardOutPath is the file where the console output of the server ends up.

  2. Add this configuration into launchd with the `launchctl` command.

    [localhost]$ launchctl load jboss.plist

Done. launchd starts the server process immediately and will do so when you login. When you logout the process is terminated. This is fine for running it for your own use. If you run this command with sudo then it will add it to the system launchd configuration and start the process when the OS loads.

If you are using Eclipse and JBoss Tools, when you create a server instance in the IDE remember to select the "Server is externally managed. Assume server is started." checkbox. Otherwise the IDE will attempt to launch another instance of the server, which will fail due to port conflicts.

Wikipedia article about launchd: http://en.wikipedia.org/wiki/Launchd

Very detailed post about launchd: http://www.afp548.com/article.php?story=20050620071558293

Stackoverflow question where I got my config sourced from: http://stackoverflow.com/questions/9604875/anyone-have-a-launchd-script-for-running-jboss-at-boot-on-mac-osx-lion

Is your tiger lost in the jungle?

Stumbled across this gem in some junk mail this week. Advertising for hair trimming gear.

Is your tiger lost in the jungle

I would love to have been a fly on the wall in the brain-storming session that produced this.

No iCloud love for audiobooks

Today I learned something new about audio books in iTunes when I purchased an audiobook from iTunes on my Macbook Air and tried to access it on my iPhone. Audiobooks don’t get included in iTunes Match and they can’t be re-downloaded from “iTunes in the cloud”. So to get a purchased audiobook from one device to another you need to do an iTunes sync.

*sigh*

So I had to do a sync. It was over WIFI so at least I didn’t need to plug anything in (like in the olden days) but it did make me realise how much my handling of my iTunes library and syncing had changed since the introduction of iTunes Match and (most recently) being able to re-download purchased movies.

I don’t even have syncing enabled for Music, Movies, TV Shows or any other iTunes library category. I haven’t done an actual sync between my iPhone or iPad and iTunes on my Macbook Air for more than a month. I just download my purchased movies, tv shows, apps and ebooks on which ever device I am using at the time, and all my music is in iTunes Match so it is available anywhere. Contacts, email, calendars etc are in iCloud. iOS updates happen “over-the-air” now and backups are performed to iCloud. There just is no reason to sync, especially since our ISP doesn’t include iTunes downloads in our bandwidth limit.

I enabled the “Manually Manage Movies” checkbox on the device Summary screen in iTunes a while ago so I could drag and drop movies from the iTunes library onto my iPad without having iTunes do a sync. This lets me have an iTunes movie library that doesn’t match the iPad. What I didn’t realise was that this allows manual management for everything, including audio books. Easy. Didn’t even have to enable syncing for audio books for it to work.

I’m guessing that Apple either has existing contracts with audio book providers that disallow them from providing re-download or distribution in iTunes Match. Movies were probably only available for re-download recently for similar reasons. So until such time as the rights holders agree to new terms then syncing with iTunes is something that isn’t going to go away.

Tagged , , ,
Follow

Get every new post delivered to your Inbox.

Join 142 other followers