• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Tomcat serving Blank Page - shows on Refresh - why?

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all,

I recently signed up for a web host provider. My website pages are Java Server Pages.
My server runs with the following applications and versions.
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 uploaded my site and began testing. I also configured what was necessary, per the instructional guides provided by the hosting company.

On occasion I have been getting a blank page, when accessing either the homepage or another page, at first attempt. If I request a page, and it returns blank, all I have to do is hit the Refresh key and everything loads. Each page after that loads as well.

What could the problem be? Your help is greatly appreciated. This problem concerns me very much.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you asked the host?

In any case, what does a View Source show when you get the blank page? Nothing at all?

Anything in the Tomcat logs.
 
Bridget Carlson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I contacted the host about this. They told me that they are not experiencing this problem. They have tried accessing the site on various operating systems in various locations. The site loads every time. They are unable to replicate the problem.

The View Source on one page showed a certain amount of the JavaScript code, but stopped at one point.

The logs, yes I looked at the Tomcat log, and most notable was the NullPointerException. It was issued on an object who's value is set via an interaction between the JSP page and a Servlet. The servlet interacts with a database, retrieves a value from a table, and sets the value into the session.

So the code causing the NullPointer in the jsp page looks like this ;


The Servlet is retrieving a value from the database and setting that value into the session.


But a refresh loads the page and the site operates as it should. What could be the problem?
 
Bear Bibeault
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you not think that was relevant information to include in your initial post?

Yes, an NPE will stop everything in its tracks and you'll only get a partial response. You need to track down the cause of the NPE and fix it.
 
Bridget Carlson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Bear Bibeault wrote:Yes, an NPE will stop everything in its tracks and you'll only get a partial response. You need to track down the cause of the NPE and fix it.



How do you explain the NPE not occurring on the Refresh?

If it was the code, the page would not load at all....agree?

So ruling out the code, what other areas can I look into?
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I would suggest making sure that the response output stream gets flushed/closed under all conditions. Many of my "iee the screen is blank" problems have been resolved by this.

Bill
(if all your pages are JSP, why bother with Apache web server, it just slows things down and is a pain to configure.)
 
Bridget Carlson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I created my website and tested things locally, on my pc, with tomcat server (localhost).
Everything worked fine. Would it not also fail locally if there was a problem with the code???

On the host provider, I'm using mod_jk. Which is the Apache Tomcat connector. Are there any specific settings or attributes that I should be looking into, that might help solve my problem?

 
Bridget Carlson
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Update On Problem

After adding some out.print's to my servlet, I got more precise information as to why this problem has been occurring.

The following error was revealed -

The last packet successfully received from the server was63030 milliseconds ago.
The last packet sent successfully to the server was 63030 milliseconds ago, which is longer
than the server configured value of 'wait_timeout'. You should consider either expiring and/or
testing connection validity before use in your application, increasing the server configured values
for client timeouts, or using the Connector/J connection property 'autoReconnect=true' to avoid
this problem.
java.net.SocketException: Broken pipe

What fixed this issue in my case, was adding the following to the my.cnf file on my server, under [mysqld], and then having the mysql server restarted.

[mysqld]
interactive_timeout=80000

In addition, I added the following to the server.xml file under the Resource parameters for connecting to the database -
testOnBorrow=true
validationQuery=select 1

I'm so very pleased with the results, and wanted to post this update. Perhaps someone else having the same problem I did will find this information to be of help:)

reply
    Bookmark Topic Watch Topic
  • New Topic