You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brandon Rodak <br...@cmcflex.com> on 2003/01/10 22:15:12 UTC
interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly
This may be a rather easy issue but with my limited knowledge of Tomcat - I
thought one of you more qualified folks would have a solution.
Whenever I visit the initial index.jsp (via index.htm as a workaround) page
I get the following server error:
java.lang.NullPointerException at
org.apache.jsp.index$jsp._jspService(index$jsp.java:75) at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
and so on....
Clicking F5 or Refresh once loads the page - so you can see it is quite a
nuisance - we have implemented Apache 1.3.27 with Tomcat 4.0.6 - I have also
posted some lines of the catalina log and error logs for review below:
Catalina_Log
2003-01-09 14:48:39 Ajp13Processor[8009][7] process: invoke
java.io.IOException: Broken pipe at
java.net.SocketOutputStream.socketWrite(Native Method) at
java.net.SocketOutputStream.write(SocketOutputStream.java:91) at
org.apache.ajp.Ajp13.send(Ajp13.java:525) at
org.apache.ajp.RequestHandler.finish(RequestHandler.java:501) at
org.apache.ajp.Ajp13.finish(Ajp13.java:395) at
org.apache.ajp.tomcat4.Ajp13Response.finishResponse(Ajp13Response.java:196)
at org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:464) at
org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:551) at
java.lang.Thread.run(Thread.java:479)
Error log
2003-01-09 22:38:16 StandardWrapperValve[jsp]: Servlet.service() for servlet
jsp threw exception java.lang.NullPointerException at
org.apache.jsp.index$jsp._jspService(index$jsp.java:75) at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
Any ideas on how I can remedy this issue so that the index.jsp page loads on
first "hit" would be greatly appreciated.
You can view the page in question here:
http://sitemaster.flex-internet.com/index.jsp
Thanks again for any and all help!
Brandon Rodak
Web Services
Computer Marketing Corporation
http://www.cmcflex.com & http://www.flex-internet.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly
Posted by Paul Yunusov <py...@rogers.com>.
On Friday 10 January 2003 05:49 pm, Brandon Rodak wrote:
> Paul,
>
> Here is a link to the Java - http://www.flex-internet.com/java.txt
>
> Thanks again for your help
>
> Brandon Rodak
> Web Services
> Computer Marketing Corporation
> http://www.cmcflex.com & http://www.flex-internet.com
Brandon, the scriptlet in your jsp gets your server's cookies from the client:
Cookie[] cookies = request.getCookies();
but on the initial request, there are no cookies set by your server on any
given client, so getCookies() returns null in accordance with the servlet
spec. That triggers a NPE when you try to process the cookies later:
for (int i=0; i<cookies.length; i++) {
...
}
Put an "if" statement around your "for" loop to check if cookies is null or
not and that should fix your problem.
Paul
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly
Posted by Brandon Rodak <br...@cmcflex.com>.
Paul,
Here is a link to the Java - http://www.flex-internet.com/java.txt
Thanks again for your help
Brandon Rodak
Web Services
Computer Marketing Corporation
http://www.cmcflex.com & http://www.flex-internet.com
-----Original Message-----
From: Pulat Yunusov [mailto:pyunusov@rogers.com]
Sent: Friday, January 10, 2003 3:13 PM
To: Tomcat Users List
Subject: Re: interesting java.lang.NullPointerException error when first
viewing an index.jsp page - refresh once and page loads correctly
On Friday 10 January 2003 04:40 pm, Brandon Rodak wrote:
> Paul,
>
> You can view the source of the page at
> http://www.flex-internet.com/source.txt
>
> and the full error and stack trace (?) at
> http://www.flex-internet.com/error.txt
>
> Thanks for the help,
>
> Brandon Rodak
> Web Services
> Computer Marketing Corporation
> http://www.cmcflex.com & http://www.flex-internet.com
Brandon, I meant you could look at index$jsp.java (line 75) mentioned in the
NPE stacktrace to look for clues. It's in your Tomcat's work directory
hierarchy. Can you post it too?
I am almost certain the problem is in that scriptlet at the top of the page
but without looking at the generated servlet's line 75, I can't tell which
null reference causes the NPE. The elders were right to caution against
scriptlets after all.
Paul
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly
Posted by Pulat Yunusov <py...@rogers.com>.
On Friday 10 January 2003 04:40 pm, Brandon Rodak wrote:
> Paul,
>
> You can view the source of the page at
> http://www.flex-internet.com/source.txt
>
> and the full error and stack trace (?) at
> http://www.flex-internet.com/error.txt
>
> Thanks for the help,
>
> Brandon Rodak
> Web Services
> Computer Marketing Corporation
> http://www.cmcflex.com & http://www.flex-internet.com
Brandon, I meant you could look at index$jsp.java (line 75) mentioned in the
NPE stacktrace to look for clues. It's in your Tomcat's work directory
hierarchy. Can you post it too?
I am almost certain the problem is in that scriptlet at the top of the page
but without looking at the generated servlet's line 75, I can't tell which
null reference causes the NPE. The elders were right to caution against
scriptlets after all.
Paul
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly
Posted by Brandon Rodak <br...@cmcflex.com>.
Paul,
You can view the source of the page at
http://www.flex-internet.com/source.txt
and the full error and stack trace (?) at
http://www.flex-internet.com/error.txt
Thanks for the help,
Brandon Rodak
Web Services
Computer Marketing Corporation
http://www.cmcflex.com & http://www.flex-internet.com
-----Original Message-----
From: Paul Yunusov [mailto:pyunusov@rogers.com]
Sent: Friday, January 10, 2003 2:19 PM
To: Tomcat Users List
Subject: Re: interesting java.lang.NullPointerException error when first
viewing an index.jsp page - refresh once and page loads correctly
On Friday 10 January 2003 04:15 pm, Brandon Rodak wrote:
> This may be a rather easy issue but with my limited knowledge of Tomcat -
I
> thought one of you more qualified folks would have a solution.
>
> Whenever I visit the initial index.jsp (via index.htm as a workaround)
page
> I get the following server error:
>
> java.lang.NullPointerException at
> org.apache.jsp.index$jsp._jspService(index$jsp.java:75) at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> and so on....
>
> Clicking F5 or Refresh once loads the page - so you can see it is quite a
> nuisance - we have implemented Apache 1.3.27 with Tomcat 4.0.6 - I have
> also posted some lines of the catalina log and error logs for review
below:
It might help if you post some snippets from the JSP. The stack trace for
the
NPE gives you a clue where in the JSP to look for the culprit and what
snippet to post.
Paul
--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly
Posted by Paul Yunusov <py...@rogers.com>.
On Friday 10 January 2003 04:15 pm, Brandon Rodak wrote:
> This may be a rather easy issue but with my limited knowledge of Tomcat - I
> thought one of you more qualified folks would have a solution.
>
> Whenever I visit the initial index.jsp (via index.htm as a workaround) page
> I get the following server error:
>
> java.lang.NullPointerException at
> org.apache.jsp.index$jsp._jspService(index$jsp.java:75) at
> org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:107) at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> and so on....
>
> Clicking F5 or Refresh once loads the page - so you can see it is quite a
> nuisance - we have implemented Apache 1.3.27 with Tomcat 4.0.6 - I have
> also posted some lines of the catalina log and error logs for review below:
It might help if you post some snippets from the JSP. The stack trace for the
NPE gives you a clue where in the JSP to look for the culprit and what
snippet to post.
Paul
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>