3 Replies Latest reply on Sep 6, 2005 11:28 AM by Scott Balmos

    Defining datasources in webapp config files?

    Scott Balmos Newbie

      Hi all,

      I was wondering if it's possible, in any way, to put datasource definition files (-ds.xml & other definitions for JavaMail, LDAP, etc) inside a webapp's EAR / WAR / SAR / whatever package? Or *must* those definition files be separate in the deploy directory? I'm trying to keep my deploy directory from growing out of control. With a single EAR file having 14 separate modules, having 14 separate datasource XML files for that single EAR gets nasty.

      Is there a way these can be packaged, like I said? If not, can some theory be provided to why not? Thanks!

      --Scott Balmos

        • 1. Re: Defining datasources in webapp config files?
          Darran Lofthouse Master

          You could put all of your datasource definitions in a single -ds.xml instead.

          • 2. Re: Defining datasources in webapp config files?
            Andy Nguyen Newbie

            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"

            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.

            • 3. Re: Defining datasources in webapp config files?
              Scott Balmos Newbie

              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).