I'm having difficulty deploying an application into JBoss 4.0.3SP1. I need to create a DataSource resource, and then attach a DataSourceRealm to it.
I've done a few things without success:
1) add the Resource and Realm globally to the server/default/deploy/jbossweb-tomcat55.sar/server.xml in the localhost Host container (with the defined Realm being the only defined Realm)
2) created a file called Application.xml in the directory server/default/deploy/jbossweb-tomcat55.sar/conf/jboss.web/localhost with the following Context definition:
<Context docBase="deploy/Application.war"> <Resource ... /> <Realm ... /> </Context>
Never mind. The problem is, of course, that JBoss does not use the standard DataSourceRealm that Tomcat uses. So, the correct thing to do here is to add my DataSource to mysql-ds.xml (or whatever database you are using), add an application-policy entry to login-config.xml, and set the security-domain in jboss-web.xml. Phew!