[jboss-as7-dev] problem with the classloader, not able to load a JDBC driver

Jesper Pedersen jesper.pedersen at jboss.org
Mon Jul 23 11:51:11 EDT 2012


On 07/23/2012 11:42 AM, Flemming Harms wrote:
> I found a solution to my problem. Had to update the xsd schema with an
> extra attribute "module" and then user need pack his JDBC driver as module.
>
> I use the code below to load the model and the driver class.
>
> Class<?> driverClass =
> Module.loadClassFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName),
> driver);
> driverClass.newInstance();
>
> <outbound-connections>
>          <database>
>              <connection module="com.h2database.h2"
> driver="org.h2.jdbcx.JdbcDataSource" name="db"
> url="jdbc:h2:/tmp/test;DB_CLOSE_DELAY=-1" username="sa" password=""
> min-pool-size="10" max-pool-size="20" />
>          </database>
> </outbound-connections>
>
> Does it make sense?

The -ds.xml functionality uses the module through the <driver> tag, so 
this would be similar.

Things to watch out for is of course the password attribute - it should 
at least support the vault mechanism I would say.

Best regards,
  Jesper


More information about the jboss-as7-dev mailing list