1 Reply Latest reply on Aug 4, 2004 7:00 AM by crowse

    putting jdbc driver in an ear file

    joeee

      Hi All,

      Sorry for the duplicate post:

      I am developing an application that will be deployed in a shared instance of JBoss at the client site, and they have asked me whether or not I could include the JDBC driver that I will need as part of the ear file I deliver to them.

      I have done a lot of search and reading documentation but have not found any information on this yet. Every doc says you need to put your driver jar in /server/lib. But my client does not want to change their configuration in this way (to avoid problems with other deployed ears I guess).

      So - the question is: is this even possible to include the driver in my ear file? This is the possibilities I could think of:

      1. Include a custom SAR file in the ear and somehow define my datasource there, with the driver included in the SAR file.

      2. Maybe use a RAR file instead, again with the driver included in the RAR.

      3. Create some kind of custom classloader to find the driver somewhere within my ear file. I have never written a classloader yet, and this would be a nonstandard thing to say the least, so I would like to avoid this if possible (unless someone can convince me that I shouldn't be scared of this!).

      So are any of these possible? I don't mind doing the work, but if anybody could give me at least a hint or a pointer to good information I would be *most* appreciative :)

      Thanks/Merci,
      Joe

        • 1. Re: putting jdbc driver in an ear file
          crowse

          hi

          Yeou ear file has som jars and wars in it.

          In the war, you cna put the driver in WEB-INF/lib

          in ejb-jars you can make a lib directory

          Do this from ant like this, you mak need to make a lib directory in the driver distribution so that the files land up in the lib subdirectory of the jar.


          setup lines in .ant.properties to point to your current driver

          e.g.

          mysql.root=/usr/local/share/mysql1.2.3.4
          
          


          then in your ejb-jar and war tasks ....

          <fileset dir="${project.target.dir}/WEB-INF">
           <include name="lib/*ejb.jar"/>
           </fileset>
          
           <fileset dir="${mysql.root}/" >
           <include name="lib/*.jar"/>
           </fileset>
          
           <fileset dir="${mssql.root}/" >
           <include name="lib/*.jar"/>
           </fileset>