Thread: maybe a serialization error?

maybe a serialization error?

From
Felipe Schnack
Date:
Hi all,
  I have a strange problem using pgsql driver in my Tomcat 4.1 server. I have an object that manages my sql queries
(simplyput: it receives the sql expression, executes it and stores the resultset in a private variable). For some
reason,if I get one of these objects of mine and set it as an page attribute in my tomcat application, the following
erroroccurs when I try fetch data from it. Why? I guess it's a serialization issue, because I'm sure this query returns
data...

java.lang.NullPointerException
    at org.postgresql.jdbc2.AbstractJdbc2ResultSet.beforeFirst(AbstractJdbc2ResultSet.java:204)
    at org.apache.commons.dbcp.DelegatingResultSet.beforeFirst(DelegatingResultSet.java:188)
    at com.w2.infra.db.DbVector.first(DbVector.java:175)
    at com.w2.infra.tags.logic.IterateTag.doTag(IterateTag.java:27)
    at com.w2.infra.tags.Taglib.doStartTag(Taglib.java:116)
    at org.apache.jsp.vest2_jsp._jspx_meth_w2_iterateTag_0(vest2_jsp.java:553)
    at org.apache.jsp.vest2_jsp._jspx_meth_w2_beanLoaderTag_0(vest2_jsp.java:524)
    at org.apache.jsp.vest2_jsp._jspService(vest2_jsp.java:238)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
    at com.w2.infra.mvc.FormHandler.redirectTo(FormHandler.java:102)
    at com.w2.vest.forms.FormCadsVest.doForm(FormCadsVest.java:54)
    at com.w2.infra.servlets.FormManager.service(FormManager.java:61)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at com.w2.infra.servlets.ErrorPageFilter.doFilter(ErrorPageFilter.java:25)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
    at

--

 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341

Re: maybe a serialization error?

From
Barry Lind
Date:
Felipe,

In looking at the code the most likely cause of this error is that your
code is working with the ResultSet after it has been closed.  That is
the only reason I can see that would generate a NullPointerException
when calling the beforeFirst() method.

thanks,
--Barry

Felipe Schnack wrote:
>   Hi all,
>   I have a strange problem using pgsql driver in my Tomcat 4.1 server. I have an object that manages my sql queries
(simplyput: it receives the sql expression, executes it and stores the resultset in a private variable). For some
reason,if I get one of these objects of mine and set it as an page attribute in my tomcat application, the following
erroroccurs when I try fetch data from it. Why? I guess it's a serialization issue, because I'm sure this query returns
data...
>
> java.lang.NullPointerException
>     at org.postgresql.jdbc2.AbstractJdbc2ResultSet.beforeFirst(AbstractJdbc2ResultSet.java:204)
>     at org.apache.commons.dbcp.DelegatingResultSet.beforeFirst(DelegatingResultSet.java:188)
>     at com.w2.infra.db.DbVector.first(DbVector.java:175)
>     at com.w2.infra.tags.logic.IterateTag.doTag(IterateTag.java:27)
>     at com.w2.infra.tags.Taglib.doStartTag(Taglib.java:116)
>     at org.apache.jsp.vest2_jsp._jspx_meth_w2_iterateTag_0(vest2_jsp.java:553)
>     at org.apache.jsp.vest2_jsp._jspx_meth_w2_beanLoaderTag_0(vest2_jsp.java:524)
>     at org.apache.jsp.vest2_jsp._jspService(vest2_jsp.java:238)
>     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
>     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
>     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
>     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
>     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
>     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
>     at com.w2.infra.mvc.FormHandler.redirectTo(FormHandler.java:102)
>     at com.w2.vest.forms.FormCadsVest.doForm(FormCadsVest.java:54)
>     at com.w2.infra.servlets.FormManager.service(FormManager.java:61)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>     at com.w2.infra.servlets.ErrorPageFilter.doFilter(ErrorPageFilter.java:25)
>     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
>     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
>     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
>     at
>




Re: maybe a serialization error?

From
Felipe Schnack
Date:
oh, now i see... probably the tag that is creating the ResultSet is giving the connection back to the connection
pool,maybe the resultset was actually closed... 

On Mon, 07 Jul 2003 17:36:35 -0700
Barry Lind <blind@xythos.com> wrote:

> Felipe,
>
> In looking at the code the most likely cause of this error is that your
> code is working with the ResultSet after it has been closed.  That is
> the only reason I can see that would generate a NullPointerException
> when calling the beforeFirst() method.
>
> thanks,
> --Barry
>
> Felipe Schnack wrote:
> >   Hi all,
> >   I have a strange problem using pgsql driver in my Tomcat 4.1 server. I have an object that manages my sql queries
(simplyput: it receives the sql expression, executes it and stores the resultset in a private variable). For some
reason,if I get one of these objects of mine and set it as an page attribute in my tomcat application, the following
erroroccurs when I try fetch data from it. Why? I guess it's a serialization issue, because I'm sure this query returns
data...
> >
> > java.lang.NullPointerException
> >     at org.postgresql.jdbc2.AbstractJdbc2ResultSet.beforeFirst(AbstractJdbc2ResultSet.java:204)
> >     at org.apache.commons.dbcp.DelegatingResultSet.beforeFirst(DelegatingResultSet.java:188)
> >     at com.w2.infra.db.DbVector.first(DbVector.java:175)
> >     at com.w2.infra.tags.logic.IterateTag.doTag(IterateTag.java:27)
> >     at com.w2.infra.tags.Taglib.doStartTag(Taglib.java:116)
> >     at org.apache.jsp.vest2_jsp._jspx_meth_w2_iterateTag_0(vest2_jsp.java:553)
> >     at org.apache.jsp.vest2_jsp._jspx_meth_w2_beanLoaderTag_0(vest2_jsp.java:524)
> >     at org.apache.jsp.vest2_jsp._jspService(vest2_jsp.java:238)
> >     at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >     at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
> >     at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
> >     at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
> >     at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> >     at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684)
> >     at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:432)
> >     at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:356)
> >     at com.w2.infra.mvc.FormHandler.redirectTo(FormHandler.java:102)
> >     at com.w2.vest.forms.FormCadsVest.doForm(FormCadsVest.java:54)
> >     at com.w2.infra.servlets.FormManager.service(FormManager.java:61)
> >     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
> >     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> >     at com.w2.infra.servlets.ErrorPageFilter.doFilter(ErrorPageFilter.java:25)
> >     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
> >     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
> >     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
> >     at
> >
>
>
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org


--

 /~\ The ASCII        Felipe Schnack (felipes@ritterdosreis.br)
 \ / Ribbon Campaign  Analista de Sistemas
  X  Against HTML     Cel.: 51-91287530
 / \ Email!           Linux Counter #281893

Centro Universitário Ritter dos Reis
http://www.ritterdosreis.br
ritter@ritterdosreis.br
Fone: 51-32303341