You are viewing a plain text version of this content. The canonical link for it is here.
Posted to taglibs-user@tomcat.apache.org by Frank Burns <fr...@the-hub.demon.co.uk> on 2004/06/08 21:21:03 UTC

JSTL1.1 and DataSource problems

I'm using Tomcat 5.0.16.

I've just upgraded from jakarta-taglibs-standard-1.0.5 to
jakarta-taglibs-standard-1.1.0.

I have a JSP containing this JSTL:

<sql:query var="results" dataSource="${applicationScope.dataSource}">
 SELECT * FROM System WHERE Id=1
</sql:query>

where applicationScope.dataSource is a DataSource that I place in the
application scope via a listener.

This worked before my upgrade, but now I get this error:

[ServletException in:/sysAdminModule/banners/generalBanner.jsp] Unable to
get connection, DataSource invalid: "java.sql.SQLException: No suitable
driver"

Any ideas why this worked with JSTL1.0 and now, with JSTL1.1, it does not?

Thanks,

Frank.


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: JSTL1.1 and DataSource problems

Posted by Kris Schneider <kr...@dotech.com>.
One other thing that might be of interest. If you're going to be using that
application-scoped data source frequently in your JSPs, you might want to have
the listener set it as the default for the sql tags:

import javax.servlet.jsp.jstl.core.Config;

Config.set(servletContext, Config.SQL_DATA_SOURCE, dataSource);

Then you don't have to specify the "dataSource" attribute in the sql tags.

Quoting Hans Bergsten <ha...@gefionsoftware.com>:

> Another possible cause is that EL expressions are not evaluated.
> If you use JSTL 1.1, make sure you're using a Servlet 2.4 web.xml
> file to enable EL evaluation:
> 
>    <http://www.hansbergsten.com/faq/details.jsp?id=1025>
> 
> Hans
> 
> Kris Schneider wrote:
> > Huh. That's usually triggered by basic config problems like not having the
> > driver available to the classloader or using a bad connection string/URL.
> How
> > 'bout doing a quick test in your listener to be sure it's actually set up
> > correctly? In other words, once the listener has the DataSource, try just
> > getting a connection from it. Did you only upgrade Standard/JSTL, or did
> > anything else in your environment change?
> > 
> > Quoting Frank Burns <fr...@the-hub.demon.co.uk>:
> > 
> > 
> >>I'm using Tomcat 5.0.16.
> >>
> >>I've just upgraded from jakarta-taglibs-standard-1.0.5 to
> >>jakarta-taglibs-standard-1.1.0.
> >>
> >>I have a JSP containing this JSTL:
> >>
> >><sql:query var="results" dataSource="${applicationScope.dataSource}">
> >> SELECT * FROM System WHERE Id=1
> >></sql:query>
> >>
> >>where applicationScope.dataSource is a DataSource that I place in the
> >>application scope via a listener.
> >>
> >>This worked before my upgrade, but now I get this error:
> >>
> >>[ServletException in:/sysAdminModule/banners/generalBanner.jsp] Unable to
> >>get connection, DataSource invalid: "java.sql.SQLException: No suitable
> >>driver"
> >>
> >>Any ideas why this worked with JSTL1.0 and now, with JSTL1.1, it does not?
> >>
> >>Thanks,
> >>
> >>Frank.
> > 
> > 
> 
> 
> -- 
> Hans Bergsten                                  <ha...@hansbergsten.com>
> Gefion Software                       <http://www.gefionsoftware.com/>
> Author of O'Reilly's "JavaServer Pages", covering JSP 2.0 and JSTL 1.1
> Author of O'Reilly's "JavaServer Faces", covering JSF 1.0
> Details at                              <http://www.hansbergsten.com/>

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: JSTL1.1 and DataSource problems

Posted by Hans Bergsten <ha...@gefionsoftware.com>.
Another possible cause is that EL expressions are not evaluated.
If you use JSTL 1.1, make sure you're using a Servlet 2.4 web.xml
file to enable EL evaluation:

   <http://www.hansbergsten.com/faq/details.jsp?id=1025>

Hans

Kris Schneider wrote:
> Huh. That's usually triggered by basic config problems like not having the
> driver available to the classloader or using a bad connection string/URL. How
> 'bout doing a quick test in your listener to be sure it's actually set up
> correctly? In other words, once the listener has the DataSource, try just
> getting a connection from it. Did you only upgrade Standard/JSTL, or did
> anything else in your environment change?
> 
> Quoting Frank Burns <fr...@the-hub.demon.co.uk>:
> 
> 
>>I'm using Tomcat 5.0.16.
>>
>>I've just upgraded from jakarta-taglibs-standard-1.0.5 to
>>jakarta-taglibs-standard-1.1.0.
>>
>>I have a JSP containing this JSTL:
>>
>><sql:query var="results" dataSource="${applicationScope.dataSource}">
>> SELECT * FROM System WHERE Id=1
>></sql:query>
>>
>>where applicationScope.dataSource is a DataSource that I place in the
>>application scope via a listener.
>>
>>This worked before my upgrade, but now I get this error:
>>
>>[ServletException in:/sysAdminModule/banners/generalBanner.jsp] Unable to
>>get connection, DataSource invalid: "java.sql.SQLException: No suitable
>>driver"
>>
>>Any ideas why this worked with JSTL1.0 and now, with JSTL1.1, it does not?
>>
>>Thanks,
>>
>>Frank.
> 
> 


-- 
Hans Bergsten                                  <ha...@hansbergsten.com>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 2.0 and JSTL 1.1
Author of O'Reilly's "JavaServer Faces", covering JSF 1.0
Details at                              <http://www.hansbergsten.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Re: JSTL1.1 and DataSource problems

Posted by Kris Schneider <kr...@dotech.com>.
Huh. That's usually triggered by basic config problems like not having the
driver available to the classloader or using a bad connection string/URL. How
'bout doing a quick test in your listener to be sure it's actually set up
correctly? In other words, once the listener has the DataSource, try just
getting a connection from it. Did you only upgrade Standard/JSTL, or did
anything else in your environment change?

Quoting Frank Burns <fr...@the-hub.demon.co.uk>:

> I'm using Tomcat 5.0.16.
> 
> I've just upgraded from jakarta-taglibs-standard-1.0.5 to
> jakarta-taglibs-standard-1.1.0.
> 
> I have a JSP containing this JSTL:
> 
> <sql:query var="results" dataSource="${applicationScope.dataSource}">
>  SELECT * FROM System WHERE Id=1
> </sql:query>
> 
> where applicationScope.dataSource is a DataSource that I place in the
> application scope via a listener.
> 
> This worked before my upgrade, but now I get this error:
> 
> [ServletException in:/sysAdminModule/banners/generalBanner.jsp] Unable to
> get connection, DataSource invalid: "java.sql.SQLException: No suitable
> driver"
> 
> Any ideas why this worked with JSTL1.0 and now, with JSTL1.1, it does not?
> 
> Thanks,
> 
> Frank.

-- 
Kris Schneider <ma...@dotech.com>
D.O.Tech       <http://www.dotech.com/>

---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org