Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > JSP Basics
|
JSP Basics Beginning-level questions on JSP. More advanced coders should post to Pro JSP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the JSP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 10th, 2004, 06:18 AM
Authorized User
 
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default Unable connect to MySQL using JSTL tag

Hi,
I am having problems similar to the ones mentioned maester18 but i am receiving a differant error..



HTTP Status 500 -

--------------------------------------------------------------------------------

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: In <driver>, invalid driver class name: "java.lang.ClassNotFoundException: com.mysql.jdbc.Driver"
    org.apache.jasper.runtime.PageContextImpl.doHandle PageException(PageContextImpl.java:864)
    org.apache.jasper.runtime.PageContextImpl.handlePa geException(PageContextImpl.java:800)
    org.apache.jsp.DataAccess.bookDB_jsp._jspService(b ookDB_jsp.java:74)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:856)


root cause

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1366)
    org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1213)
    java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:315)
    java.lang.Class.forName0(Native Method)
    java.lang.Class.forName(Class.java:217)
    org.apache.taglibs.standard.tag.common.sql.DataSou rceWrapper.setDriverClassName(Unknown Source)
    org.apache.taglibs.standard.tag.common.sql.SetData SourceTagSupport.doStartTag(Unknown Source)
    org.apache.jsp.DataAccess.bookDB_jsp._jspx_meth_sq l_setDataSource_0(bookDB_jsp.java:91)
    org.apache.jsp.DataAccess.bookDB_jsp._jspService(b ookDB_jsp.java:60)
    org.apache.jasper.runtime.HttpJspBase.service(Http JspBase.java:133)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:856)
    org.apache.jasper.servlet.JspServletWrapper.servic e(JspServletWrapper.java:311)
    org.apache.jasper.servlet.JspServlet.serviceJspFil e(JspServlet.java:301)
    org.apache.jasper.servlet.JspServlet.service(JspSe rvlet.java:248)
    javax.servlet.http.HttpServlet.service(HttpServlet .java:856)


note The full stack trace of the root cause is available in the Tomcat logs.


--------------------------------------------------------------------------------

Apache Tomcat/5.0.16







The files that i have within ,my lib folder are
Apache Tomcat/5.0.16
http://localhost:8080/jsp-examples/d...ess/bookDB.jsp

mysql-connector-java-3.0.10-stable-bin.jar

jaxen-full.jar
LICENSE
LICENSE-JAXEN
LICENSE-SAXPATH
saxpath.jar
dom.JAP
jaxp-api.jar
jdbc2_0-stdext.jar
jstl.jar
sax.jar
standard.jar
xalan.jar
xercesImpl.jar


And I have typed the code as it appears in the book....

PW
__________________
PW
 
Old February 10th, 2004, 11:28 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Try to copy the JAR files into your WEB-INF/lib folder.

 
Old February 11th, 2004, 02:48 AM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Btw... to ease the administration of MySQL, download "MySQLCC" from sourceforge.net.
This will help you spend more time on JSP rather than configuring the database.

Cheers,
Maester

 
Old February 11th, 2004, 08:05 AM
Authorized User
 
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Cheers maester18,
I already have the mysql control centre fownlaoded , its very useful toool alright and saves alot of time.

PW
 
Old February 14th, 2004, 02:17 PM
Authorized User
 
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi , I am now receiving the following error message when trying to execute the bookdb.jsp example
Please help

"Attribute users invalid for tag setDataSource according to TLD"

The code is as follows....






<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core_rt" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql_rt" %>

<sql:setDataSource var="datasource"
     driver="com.mysql.jdbc.Driver"
     url="jdbc:mysql://localhost/publish"
    users="publish" password="wrox"/>


<sql:query var="books" dataSource="${datasource}">
  SELECT id, title, price FROM book
</sql:query>
<html>
  <head>
    <title>A First JSP Database</title
  </head>
  <body>
    <table border="1">
      <tr>
        <td>id</td><td>title</td><td>price</td>
      </tr>
<c:forEach items="${books.rows}" var="row">
      <tr>
        <td><c:out value="${row.id}" /></td>
        <td><c:out value="${row.title}" /></td>
        <td><c:out value="${row.price}" /></td>
      </tr>
</c:forEach>
    </table>
  </body>
</html>


PW
 
Old February 23rd, 2004, 03:12 PM
Authorized User
 
Join Date: Jan 2004
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

iSSUE NOW RESOLVED,
i HAD NOT CONFIGURED CLASSPATHS CORRECTLY.

PW
 
Old March 2nd, 2004, 09:46 AM
Registered User
 
Join Date: Mar 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Deuce868
Default

What did you have to do to your classpath to get it working?

I am getting the same error on my mysql driver and I see that the book states to set the classpath to %CATALINA_HOME%\common\lib\servlet.jar yet there is no servlet.jar in that folder.

I have installed Tomcat to C:\Tomcat and the install is working so I don't think I have any problems with my CATALINA_HOME variable.

Thanks

 
Old March 7th, 2004, 04:12 PM
Registered User
 
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

my CLASSPATH is setup to be like this :
CLASSPATH=%CATALINA_HOME%\webapps\stealth\WEB-INF\lib;%CATALINA_HOME%\common\lib





 
Old March 29th, 2004, 01:29 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i am also facing the same problem so please can anybody tell me the values of :
PATH , CLASSPATH , JAVA_HOME , CATALINA HOME so that i can solve the above problem as faced by PatrickWalsh.U all can mail me at : ankit_29882@yahoo.com
thx in advance,
Ankit
 
Old March 29th, 2004, 01:34 PM
Registered User
 
Join Date: Feb 2004
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am also facing the same problem so please can anybody tell me the values of :
PATH , CLASSPATH , JAVA_HOME , CATALINA HOME so that i can solve the above problem as faced by PatrickWalsh.U can mail me at : ankit_29882@yahoo.com
thx in advance,
Ankit
Quote:
quote:Originally posted by PatrickWalsh
 iSSUE NOW RESOLVED,
i HAD NOT CONFIGURED CLASSPATHS CORRECTLY.

PW





Similar Threads
Thread Thread Starter Forum Replies Last Post
unable to connect sultan SQL Server 2005 1 June 6th, 2008 03:38 PM
Unable to render the descriptor tag steelrose XSLT 2 June 5th, 2008 04:27 PM
unable to connect PHP with Mysql bhavna MySQL 1 June 5th, 2007 07:52 PM
Unable to load tag handler class nithya123 BOOK: Professional Jakarta Struts 0 September 1st, 2005 10:02 AM
Can't connect to MySQL using JSTL tag maester18 JSP Basics 3 January 31st, 2004 05:04 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.