Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

JSP page of site shows Blank Page - but loads on Refresh - why???

843840Oct 9 2009 — edited Oct 19 2009
Hello all,

On occasion, when I access a page of my website, I get a blank page. But, when I hit Refresh, it shows, and each page thereafter successfully loads.

Most notably, this problem tends to occur on the first access of a page, on a new day.

This is the first time I have signed up with a host provider to host my own site.
My pages are Java Server Pages. Server specs and versions are below :
Apache web server 2.2
Tomcat 5.5.27
Java 1.5.0.19 (SE 5)
Mysql 5.1.38
Mod_jk 1.2.28

I have very limited knowledge of mod_jk. In fact I had never used it for anything before, because I created and tested my site on my local computer, and only til recently has it been put up live. I am in testing phase now.

I want to be as informative as possible in order for this problem to be figured out.

1) I did contact the host provider about this problem. They reply that my server settings are fine, and that they themselves have accessed my site, and it loads. They are unable to replicate the problem I'm having. They have tried accessing my site on various operating systems and in various locations, and haven't had any failures.

2) I did check the Tomcat logs as well. A NullPointerException is being logged. The object on the jsp page has a value that is retrieved from a session object. That session object is in turn set by a Servlet that makes a call to a database table to retrieve a value. Thus that value is set as a session object. I can't understand why that would result in a NullPointerException on that object in the JSP page, but NO exceptions when I hit Refresh and everything loads.

To make this clearer, here is an example below :

JSP Page_
<%  RequestDispatcher rd = request.getRequestDispatcher("go.myservlet");
       rd.include(request,response);

       String myValue = (String)session.getAttribute("valueFromSession");
       // ************
      // the myValue object is used across the entire site

      //***** Here is where the NullPointerException is logged *****
      if(myValue.equals("aCertainValue")) {  
        //do this
      }
%>
Servlet_
      rs = stmt.executeQuery("Select theValue from myDbTable");
      rs.next();
      session.setAttribute("valueFromSession",rs.getString(1));
This blank page problem is intermittent. I don't understand why it occurs, and why a Refresh allows things to load.
Can you help?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 16 2009
Added on Oct 9 2009
9 comments
4,852 views