When using the Connection tag to obtain connections from JNDI datasources, if a DataSource is not found at the specified JNDI context string, the system reports a NullPointerException with no other detail. This can be confusing to troubleshoot as there is no indication in the error message as to why doEntTag should encounter said Exception. In reviewing the source, there appears to be no check for a null return from JNDI inside the doEndTag method. I would strongly recommend a few well-placed lines of additional code to provide better error reporting. This Taglib is *awesome*! :) I used to use Cold Fusion but don't see any reason to go back now!
Glad you like the tags. :) That JNDI support was contributed, and I don't really use it myself. From the Javadocs on Context.lookup(String), it sounds like an incorrect context string should throw a specific NamingException , not a NullPointerException. Isn't that the case?
My read of the JavaDocs at http://java.sun.com/products/jndi/1.2/javadoc/javax/naming/Context.html#lookup (java.lang.String) didn't seem to indicate that a NamingException would necessarily be thrown if no object is found. It seems that the NamingException is only thrown if a "naming exception is encountered" (whatever that *specfically* means... *smile*). My guess is that the decision to either return null or thrown an exception may be up to the implementor. Again, just my guess. Either way, a check for null seems prudent (to me, having spent a few hours troubleshooting this under Tomcat one rainy weekend). :)
I will take a look on this bug later this week...
Fixed. The problem was not related to JNDI lookup, but with a DataSource object been set in the JSP context. Here is the message you will get now: org.apache.jasper.JasperException: Did not find a DataSource bean mamed myDS2