Thanks - this is an excellent article!
However, in "The Limitations of Packaging", it basically says JMX MBeans aren't covered by the article. So, I guess the .sar file is a necessary evil. Do the jboss deployment mechanisms ear, war, or jar files provide for embedding sars?
I found the answer to my own question; alongside the application.xml file, one can have a jboss-app.xml file that can in turn specify the .sar file.
The remaining problem I have is that when I undeploy (by deleting the ear from server/default/deploy, I get a variety of error messages (appended below). The first I have absolutely no idea what it's about. The second indicates to me that for some reason jboss is trying to stop the service twice (it successfully stops it earlier in the log trace).
15:52:48,128 INFO [MainDeployer] not deleting localUrl, it is null or not a copy: file:/usr/java/jboss-3.0.3/server/default/tmp/deploy/serv
and the other is15:52:48,129 WARN [ServiceController] Ignoring request to destroy non-existant service: owr:service=SequenceGeneratorService,name=mbean/owr
Yes, sar files are specific to JBoss. The JBoss docs cover what is in a sar file. Or you can unjar any of the sar files that come with JBoss to see the structure. I think you can put a sar file inside an ear file, but I am not sure of the specifics and I am not sure why you would want to.
You can use JBoss "Russian Doll" packaging: you can put any xAR in any xAR (SAR in EAR in JAR in WAR in ...). The rule is "INNER FIRST, OUTER LAST". By playing smartly, you can even have all your dependencies between your components satisfied.
Not sure about these errors, but it helps debugging to start with a clean slate. So shut down JBoss. Then delete the tmp directory that is within default. Then start up JBoss and see if you have same problems.