You could put all of your datasource definitions in a single -ds.xml instead.
I place mydb-ds.xml in the root of my ear. My ear/META-INF/jboss-app.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 1.4//EN" "http://www.jboss.org/j2ee/dtd/jboss-app_4_0.dtd"> <jboss-app> <module> <service>mydb-ds.xml</service> </module> </jboss-app>
I still have to copy the JDBC driver jar to the server's lib directory. Anyone know if it's possible to package the JDBC driver jar in the ear? The DTD for -ds.xml files doesn't look like it has a way to specify a classpath, like regular -service.xml files. I suppose I could use the XSLT stylesheet that JBoss uses to transform the -ds.xml into a -service.xml ahead of time and add the classpath entry, but I was hoping there was an easier way.
darran: I realized that after the fact. The point was to include the service definitions with the app, instead of having them outside on their own in the deploy dir. Just keeps things neater, IMO.
Andy: THANKS!!! That works perfectly. Personally, the libdir thing doesn't matter to me, since I want my JDBC driver to be available system-wide to all users (no sense in replicating drivers in each app).