You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ge <el...@gmx.net> on 2008/08/31 10:51:39 UTC
servlet works, jsp does not
Hi,
I was away for 2 weeks.
Now checked:
>> As soon as I copy mysql-connector-java-5.1.5-bin.jar
>> into /usr/share/tomcat5/common/lib, --restart tomcat5--
>> and try test.jsp, I get this:
>> javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude"
>Did you restart tomcat after the move? It's required when you change
>the contents of common/lib.
I restarted tomcat after having moved the driver. (/etc/init.d/tomcat5 restart)
If I rename the driver in
/usr/share/tomcat5/common/lib to xmysql-connector-java-5.1.5-bin.jar
and restart tomcat, I get again:
Results
${row.foo} ${row.bar}
----------------
jsp code:
---------
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<sql:query var="rs" dataSource="jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude">
select id, foo, bar from testdata
</sql:query>
<html>
<head>
<title>DB Test</title>
</head>
<body>
<h2>Results</h2>
<table>
<c:forEach var="row" items="${rs.rows}">
<tr>
<td> <c:out value="${row.foo}"/></td>
<td> <c:out value="${row.bar}"/></td>
</tr>
</c:forEach>
</table>
</body>
</html>
------
Servlet still works perfectly, just jsp fails.
Thanks in advance for any help
-eleonora
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: servlet works, jsp does not
Posted by Martin Gainty <mg...@hotmail.com>.
I've used 3.1 driver with no problemshttp://dev.mysql.com/downloads/connector/j/3.1.html
*if your app requires or implements any of the following capabilities*JDBC-4.0
NCHAR
NVARCHAR and
NCLOB types
then stay with 5.1 driverhttp://dev.mysql.com/downloads/connector/j/5.1.htmlfor jsp cache issues try setting StringCache to 'false'
conf/catalina.properties filetomcat.util.buf.StringCache.byte.enabled=false
i would also delete contents of $TOMCAT_HOME/work folder
HTHMartin______________________________________________ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > From: eleonora46@gmx.net> To: users@tomcat.apache.org> Date: Sun, 31 Aug 2008 10:51:39 +0200> Subject: servlet works, jsp does not> > Hi, > > I was away for 2 weeks.> Now checked:> > >> As soon as I copy mysql-connector-java-5.1.5-bin.jar> >> into /usr/share/tomcat5/common/lib, --restart tomcat5--> >> and try test.jsp, I get this:> >> javax.servlet.ServletException: Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude"> > >Did you restart tomcat after the move? It's required when you change> >the contents of common/lib.> > I restarted tomcat after having moved the driver. (/etc/init.d/tomcat5 restart)> > If I rename the driver in > /usr/share/tomcat5/common/lib to xmysql-connector-java-5.1.5-bin.jar> and restart tomcat, I get again:> Results> ${row.foo} ${row.bar}> > ----------------> > jsp code:> ---------> <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>> > <sql:query var="rs" dataSource="jdbc:mysql://localhost:3306/javatest?user=javauser&password=javadude">> select id, foo, bar from testdata> </sql:query>> > <html>> <head>> <title>DB Test</title>> </head>> <body>> > <h2>Results</h2>> > > <table>> <c:forEach var="row" items="${rs.rows}">> <tr>> <td> <c:out value="${row.foo}"/></td>> <td> <c:out value="${row.bar}"/></td>> </tr>> </c:forEach>> </table>> </body>> </html>> ------> > Servlet still works perfectly, just jsp fails.> > Thanks in advance for any help> -eleonora> > > ---------------------------------------------------------------------> To start a new topic, e-mail: users@tomcat.apache.org> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org> For additional commands, e-mail: users-help@tomcat.apache.org>
_________________________________________________________________
Talk to your Yahoo! Friends via Windows Live Messenger. Find out how.
http://www.windowslive.com/explore/messenger?ocid=TXT_TAGLM_WL_messenger_yahoo_082008