How should I make JBoss temporarily ignore an MBean service?
Question
I am using a single JBoss deploy directory for multiple J2EE projects that I'm working on. (Note, I'm not looking for answers that tell me that I shouldn't be doing this.) I have written a scheduler service mbean that lives in the deploy
directory, e.g., an XML file containing
<server>
...
<mbean code= ... >
<attribute ... >
...
</mbean>
</server>
That XML file only contains that one mbean
tag in the server
tag, so it would be sufficient to make JBoss ignore the entire XML file. That mbean is specific to one of my projects, so I'm looking for the simplest way to hide it from JBoss when I'm working on a different J2EE project.
Right now, I'm accomplishing this by commenting out the entire mbean
tag inside of the file (manually). This is ugly. Other than moving the XML file out of the deploy
directory, is there a better/cleaner/recommended way to do this?
Solution
The cleanest solution that I can think of would be to create two configurations where one contained the mbean and the other didn't. Then you could just:
./run.sh -c config_with_mbean
or
./run.sh -c config_without_mbean
OTHER TIPS
You can configure different deployment directories for the same JBoss instance in the jboss-service.xml file. I usually like having my applications apart from the deploy folder. I've seen the "rm -rf *.ear" command too many times.