[jboss-as7-dev] problem with the classloader, not able to load a JDBC driver
Jason T. Greene
jason.greene at redhat.com
Mon Jul 23 11:58:32 EDT 2012
On 7/23/12 10:51 AM, Jesper Pedersen wrote:
> 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.
If you make the attribute definition have expressions=true, it will
automatically enable vault support.
--
Jason T. Greene
JBoss AS Lead / EAP Platform Architect
JBoss, a division of Red Hat
More information about the jboss-as7-dev
mailing list