The following code will generate a ClassCastException instead of a JspException: <% pageContext.setAttribute("invalidDataSource", new Integer("-1")); %> <sql:query var="resultSet" dataSource= "${invalidDataSource}" > <c:out value="${sqlProps.Select_Jstl_Tab1_By_Id_Query}" /> </sql:query> Using the same code above, a NullPointerException will be generated if I change the dataSource attribute to: dataSource= "${invalidDatasource}"
Fixed with new setDataSource implementation.