Weblogic, sql-taglib and JNDI: DataSource invalid: No suitable driver found

On a Weblogic 10 environment, you may get an error like
javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: „java.sql.SQLException: No suitable driver found for jndi_ds
if you are using the sql-taglib to access your JNDI name from the Weblogic application server, configured via the Weblogic console.

The solution is quiet simple, but not that good documented. It is not possible to use the paramter „driver“ inside the sql:setDataSource – tag. You rather have to promote the JNDI name in your web.xml like this:

<resource-ref>
<res-ref-name>jndi_ds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>

Than you can set the dataSource with the sql:setDataSource – tag like this:

<sql:setDataSource dataSource="jndi_ds" />

and finally use the sql-taglib as you did in any other environment like Tomcat server and so on.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert