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.

velocity.log im „aktuellen“ Verzeichnis

Beim Einsatz von Velocity in Spring Projekten kannes vorkommen, dass Velocity im „aktuellen“ Verzeichnis loggen will. Jedoch kann Velocity auch ein existierendes Commons Logging / Log4j mit nutzen, indem man im classpath eine velocity.properties-Datei anlegt:

#runtime.log.logsystem.class=org.apache.velocity.runtime.log.SimpleLog4JLogSystem
runtime.log.logsystem.class=org.apache.velocity.tools.generic.log.CommonsLogLogSystem
runtime.log.logsystem.log4j.category=velocity