Given: <sql:setDataSource dataSource="${jstlDS}" var='driverInfoDS' /> Result: root cause > javax.servlet.jsp.JspTagException: In <driver>, invalid driver class name: " URL=jdbc:sybase:Tds:ace:4100/tempdb?FAKE_METADATA=true" > at org.apache.taglibs.standard.tag.common.sql.DataSourceUtil.setUsingParams(DataSourceUtil.java:176) > at org.apache.taglibs.standard.tag.common.sql.DataSourceUtil.setDataSource(DataSourceUtil.java:124) > at org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport.doStartTag(SetDataSourceTagSupport.java:110) > at org.apache.taglibs.standard.tag.el.sql.SetDataSourceTag.doStartTag(SetDataSourceTag.java:104)
Ryan, I'm not sure I understand the bug report. The following works for me: <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %> <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %> <%! public static class Foo implements javax.sql.DataSource { public java.sql.Connection getConnection() { return null; } public java.sql.Connection getConnection(String a, String b) { return null; } public int getLoginTimeout() { return 0; } public java.io.PrintWriter getLogWriter() { return null; } public void setLoginTimeout(int a) { } public void setLogWriter(java.io.PrintWriter a) { } } %> <% pageContext.setAttribute("myDataSource", new Foo()); %> <sql:setDataSource var="new" dataSource="${myDataSource}" /> --- Is the problem that the driver within the String representation of a DataSource you're passing isn't valid? If so, that's an issue we're waiting on spec clarification for.
I beleive the problem could be related to the fact that our DataSource overrides the toString() method. The Error message reported shows the result of calling that method.
Created attachment 1631 [details] Corrects ClassCastExceptions in SetDataSourceTagSupport
Actually, it appears Jan corrected this issue already. The ExpressionManager was configured to evaluate as a String instead of an Object. However, there is now an issue with ClassCastExceptions being raised. I've atteched a patch to this bug that corrects the issue.
Fixed: - Applied Ryan's patch (thanks, Ryan!) - Also removed DataSourceUtil constructor, in which a DataSourceWrapper was allocated. This was out-of-date, since the wrapper now is allocated inside setUsingParams().