tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Philp <sph...@ameritech.net>
Subject Re: Problem with DBTags
Date Fri, 10 Aug 2001 05:00:58 GMT
Morgan Delagrange wrote:
> 
> You could also send me the stack trace, if it shows
> which tag is generating the null pointer.  It's
> possible I need to implement recent clarifications to
> the Servlet spec.


Here's the trace I get when attempting to use two statements (same
connection) on a single page:

500 Servlet Exception

java.lang.NullPointerException
        at
centura.java.sqlbase.SqlbaseResultSet.getColumnType(SqlbaseResultSet.java:419)
        at
org.apache.taglibs.jdbc.resultset.GetColumnTag.doStartTag(GetColumnTag.java:124)
        at _index__jsp._jspService(/apc-ecsr/index.jsp:38)
        at com.caucho.jsp.JavaPage.service(JavaPage.java:87)
        at com.caucho.jsp.JavaPage.subservice(JavaPage.java:81)
        at com.caucho.jsp.Page.service(Page.java:398)
        at
com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:166)
        at
com.caucho.server.http.Invocation.service(Invocation.java:272)
        at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:128)
        at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:209)
        at
com.caucho.server.http.QRequestDispatcher.forward(QRequestDispatcher.java:96)
        at
com.caucho.server.http.FileServlet.service(FileServlet.java:288)
        at
com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:82)
        at
com.caucho.server.http.Invocation.service(Invocation.java:272)
        at
com.caucho.server.http.CacheInvocation.service(CacheInvocation.java:128)
        at
com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:334)
        at
com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:266)
        at com.caucho.server.TcpConnection.run(TcpConnection.java:140)
        at java.lang.Thread.run(Thread.java:484)


Resin 2.0.1 (built Tue Jul 10 13:13:19 PDT 2001) 


Here's the page that generates the error:

<%@ page session="true" %>
<%@ taglib uri="/WEB-INF/request.tld" prefix="req"  %>
<%@ taglib uri="/WEB-INF/session.tld" prefix="sess" %>
<%@ taglib uri="/WEB-INF/dbtags.tld"  prefix="sql"  %>
 
<sql:connection id="conn1">
        <sql:jndiName>java:comp/env/jdbc/advdb</sql:jndiName>
</sql:connection>
 
<req:request id="reqProperties"/>
 
<req:isuserinrole role="salesagent">
        <sql:statement id="stmt1" conn="conn1">
                <sql:query>
                        select sacode, dbname from security_cust 
			where logon_id = '<jsp:getProperty name="reqProperties"
property="remoteUser"/>'
                </sql:query>
                <sql:resultSet id="rs1">
                        <sess:setattribute name="salesagentCode">
				<sql:getColumn position="1"/>
			</sess:setattribute>
                        <sess:setattribute name="jndiDBName">
				<sql:getColumn position="2"/>
			</sess:setattribute>
                </sql:resultSet>
        </sql:statement>
        <sql:connection id="conn2">
                <sql:jndiName><sess:attribute
name="jndiDBName"/></sql:jndiName>
        </sql:connection>
 
        <sql:statement id="stmt2" conn="conn2">
                <sql:query>
                        select saname from salesagent 
			where sacode = <sess:attribute name="salesagentCode"/>
                </sql:query>
                <sql:resultSet id="rs2">
                        <sess:setattribute name="salesagentName">
				<sql:getColumn position="1"/>
			</sess:setattribute>
                </sql:resultSet>
        </sql:statement>
</req:isuserinrole>
 
<jsp:forward page="/mainMenu.jsp"/>


My question to the Resin author received the following explanation of
what might cause problems.  I admit I'm a complete newbie to Java, JSP,
and taglibs, so I'm not sure of the implications of his statement:

	There are two possible changes in the taglibs.  First any attributes, 
	e.g. setFoo, must only be set by the servlet engine.  Some taglibs set
a 
	default value if the user hasn't set the attribute.  Second, the taglib 
	needs to initialize in the doStartTag method.  It can't rely on the 
	release() method.  The release() is called before the end of the page, 
	but it's not called in between reuse.


Thanks for your continued help,

--
Steve Philp
Advance Packaging Corporation
sphilp@ameritech.net

Mime
View raw message