Does anyone have experience bundling a datasource (-ds.xml) definition + login-config.xml as a service archive in jboss? I’ve been fighting with this for awhile to no avail. I’m just looking for some pointers on how I should be laying the .sar out. I want the .sar to ultimately live in a .ear. Any pointers greatly appreciated!
Does anyone have experience bundling a datasource (-ds.xml) definition + login-config.xml as a service
Share
This is relatively straightforward task.
Your EAR file needs to have following layout:
where my-ds.xml contains datasource definition as usual. my-login-module-service.xml defines MBean based on the DynamicLoginConfig class. These modules are then referenced within jboss-app.xml (custom JBoss deployment descriptor) as demostrated here:
Easiest way how to create Login Module definition is to use support for embedded XML documents as attributes values. Such a config (my-login-module-service.xml) will looks like this:
You can verify successful deployment using JNDIVIew bean (java:/jaas/my-policy-123 in this example).
For deployment including custom classes it’s better to choose SAR archive deployment together with custom code. In such a case you can separate MBean definition and Login Module config (META-INF/jboss-service.xml) :
META-INF/login-config.xml will then contain your policy configuration.
I’m using this approach on JBoss AS 4.x.