Re: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly

2003-01-11 Thread Paul Yunusov
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; icookies.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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly

2003-01-10 Thread Paul Yunusov
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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly

2003-01-10 Thread Brandon Rodak
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:[EMAIL PROTECTED]]
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:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




Re: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly

2003-01-10 Thread Pulat Yunusov
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:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]




RE: interesting java.lang.NullPointerException error when first viewing an index.jsp page - refresh once and page loads correctly

2003-01-10 Thread Brandon Rodak
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:[EMAIL PROTECTED]]
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:
mailto:[EMAIL PROTECTED]
For additional commands, e-mail:
mailto:[EMAIL PROTECTED]



--
To unsubscribe, e-mail:   mailto:[EMAIL PROTECTED]
For additional commands, e-mail: mailto:[EMAIL PROTECTED]