Hello all,

I'm relatively new to JSPs, but I was able to successfully and install one
other tag library (The Date/Time taglib).  I'm not having much luck with the
dbtags library, though.

Basically, I'm running a MySQL database using the 2.0.4 MM JDBC driver and
while the page attempts a connection with the database (this I know because
if I leave out a correct username or password the error message indicates a
login-error) I get a:

java.lang.NullPointerException
        at org.apache.taglibs.jdbc.resultset.ResultSetTag.doStartTag(

Now, I've read that this taglib requires either Jave 2 EE (rather than
Standard, which is what I'm using) or a driver that supports the Optional
API for JDBC 2.0.

I suspect that my JDBC driver may not be truly 2.0 compliant.  Doesn't
anyone have any suggestions for different drivers to try, or some insight on
something I might be doing wrong here?

Thanks in advance!

The full code examples follow:

Here's the jsp source:

<%@ taglib uri="http://jakarta.apache.org/taglibs/dbtags"; prefix="sql" %>

<%-- open a database connection --%>

<sql:connection id="conn1">
        <sql:url>jdbc:mysql://probably.shouldn't tell</sql:url>
        <sql:driver>org.gjt.mm.mysql.Driver</sql:driver>
        <sql:userId>not.telling</sql:userId>
        <sql:password>not.telling</sql:password>
</sql:connection>

<%-- open a database query -->

<table>
        <sql:statement id="stmt1" conn="conn1">
                <sql:query>
                        select articleID from article
                </sql:query>
        <%-- loop through the rows of your query --%>
        <sql:resultSet id="rset2">
                <tr>
                        <td>
                                <sql:getColumn position="1"/>
                        </td>
                </tr>
        </sql:resultSet>
</sql:statement>
        </table>

<%-- close database connection --%>
<sql:closeConnection conn="conn1"/>




Here's the full error message:

Error: 500
Location: /hnwapps/hnwNewsletter/database_test.jsp
Internal Servlet Error:
javax.servlet.ServletException
        at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:459)
        at
hnwNewsletter._0002fhnwNewsletter_0002fdatabase_0005ftest_0002ejspdatabase_0
005ftest_jsp_9._jspService(_0002fhnwNewsletter_0002fdatabase_0005ftest_0002e
jspdatabase_0005ftest_jsp_9.java:351)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection
(Ajp13ConnectionHandler.java:160)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)
Root cause: 
java.lang.NullPointerException
        at
org.apache.taglibs.jdbc.resultset.ResultSetTag.doStartTag(ResultSetTag.java:
128)
        at
hnwNewsletter._0002fhnwNewsletter_0002fdatabase_0005ftest_0002ejspdatabase_0
005ftest_jsp_9._jspService(_0002fhnwNewsletter_0002fdatabase_0005ftest_0002e
jspdatabase_0005ftest_jsp_9.java:261)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va:177)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
        at org.apache.tomcat.core.Handler.service(Handler.java:286)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:79
7)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
        at
org.apache.tomcat.service.connector.Ajp13ConnectionHandler.processConnection
(Ajp13ConnectionHandler.java:160)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
        at java.lang.Thread.run(Thread.java:484)


..................................................

Marc Elliott
Director of Information Architecture / HNW Inc.
Digital Solutions for High-Net-Worth Marketers
ph: 617-243-9199 x224
fx: 815-327-4167 

Reply via email to