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.<br><br>I use the code below to load the model and the driver class.<br>
<br>Class<?> driverClass = Module.loadClassFromCallerModuleLoader(ModuleIdentifier.fromString(moduleName), driver);<br>driverClass.newInstance();<br><br><outbound-connections><br>
<database><br> <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" /><br>
</database><br></outbound-connections> <br><br>Does it make sense?<br><br>Thanks<br><br><div class="gmail_quote">2012/7/20 Flemming Harms <span dir="ltr"><<a href="mailto:flemming.harms@gmail.com" target="_blank">flemming.harms@gmail.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi<br><br>I'm trying to finish <a href="https://issues.jboss.org/browse/AS7-1371" target="_blank">https://issues.jboss.org/browse/AS7-1371</a> but I ran into a problem with the class loader. I need way to load the class for a specified JDBC driver, but I can't seem to figure out how to make it available on the classpath too my authentication service.<br>
<br>I try to load the connection class like this, and testing it with the existing H2 JDBC driver:<br>ClassLoader original = null;<br> try {<br> original = Thread.currentThread().getContextClassLoader();<br>
if (original != null) {<br> Thread.currentThread().setContextClassLoader(null);<br> }<br> Class.forName(this.driver).newInstance();<br> } finally {<br> if (original != null) {<br>
Thread.currentThread().setContextClassLoader(original);<br> }<br>}<br> <br>The user can setup a outbound connection to a database for authentication, by using the configuration below <br><br> <security-realm name="ManagementRealm"><br>
<authentication><br> <local default-user="$local"/><br> <database connection="db" plain-text="true"><br> <!-- simple-select-users table="users" username-field="user" password-field="password"/ --><br>
<sql-select-users sql="select user,password from users where user = ?" /><br> </database><br> </authentication> <br></security-realm><br><br><outbound-connections><br>
<database><br> <connection 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" /> <br>
</database><br></outbound-connections> <br><br>Any suggestions how to solve this?<br><br>Thanks!<br><br>br<span class="HOEnZb"><font color="#888888"><br>Flemming<br>
</font></span></blockquote></div><br>