This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Struts and the fly likes Page works sometimes, but sometimes no HTTP response, blank page Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Page works sometimes, but sometimes no HTTP response, blank page" Watch "Page works sometimes, but sometimes no HTTP response, blank page" New topic
Author

Page works sometimes, but sometimes no HTTP response, blank page

Antonio Walls
Greenhorn

Joined: Jun 12, 2012
Posts: 5
Hey smart people,

I just acquired a web application that has been functioning fine for over a year, with the most recent update in January. About a month ago, the page started acting finnicky, and sometimes will not load at all (blank white page) until it's refreshed several times. Obviously our userbase isn't very happy!

The page uses Struts/JSP/jQuery/MySQL 5.1.49 and is running on Tomcat 6.0.29. I'm not very experienced with most of these, but need to find a way to fix the problem. When the page fails to load, there's no HTTP response and the source is blank. The only thing that has changed to the webapp recently is 2 months ago we transferred the domain name registrar... (shouldn't affect anything?).

There is a slight difference in HTTP response headers when the page doesn't load:
Normal:
Content-Language en-US
Content-Type text/html;charset=ISO-8859-1

Blank:
Content-Type text/plain

Some days are worse than others, and generally the logs show more errors on those days (who would've guessed...). The main error is:
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
I know very little about Struts. The only reason I'm skeptical this is the issue is that this error is in the logs well before there were any problems. Granted there are MORE occurences of this error now, but it seems like we should've seen *some* problems before, but it was working perfectly.

NB: This is my first code forum post anywhere so my bad if I didn't provide enough info/it's not a good question, but I don't have a clue what to do and have spent a decent amount of time looking for a solution, both here and elsewhere!

Thanks for any info
Antonio Walls
Greenhorn

Joined: Jun 12, 2012
Posts: 5
Here's some additional details from the logs. These are the errors that have been occurring frequently, I'm not sure which are bad errors and which are more like warnings:

12 Jun 2012 13;37:40,658 WARN [User:] OgnlValueStack:49 - Error setting expression 'set[]' with value '[Ljava.lang.String;@1e74cb5'
ognl.ExpressionSyntaxException: Malformed OGNL expression: set[] [ognl.ParseException: Encountered " "]" "] "" at line 1, column 5.


12 Jun 2012 13;32:23,141 ERROR [User:] JDBCExceptionReporter:78 - Deadlock found when trying to get lock; try restarting transaction
12 Jun 2012 13;32:23,141 ERROR [User:] AbstractFlushingEventListener:301 - Could not synchronize database state with session
org.hibernate.exception.LockAcquisitionException: Could not execute JDBC batch update


The timestamp on the OGNL error is the only one that seems to coincide with when I see the problem, but it also occurs a lot when I don't see any issues. This could mean it's just unrelated, or that the errors are coming from our outside users on the webapp.
Mohana Rao Sv
Ranch Hand

Joined: Aug 01, 2007
Posts: 485

This is the scenario I come across I thought it might help you.

sometimes will not load at all (blank white page)

When you are returning null you will display blank page or if you were using tiles there is some expection happening you were not handling it properly.


The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]

Here you were trying to access a resource without passing through the filter StrutsPrepareAndExecuteFilter.

You can ignore OGNL warnings and change the log level for OGNL


ocjp 6 — Feeding a person with food is a great thing in this world. Feeding the same person by transferring the knowledge is far more better thing. The reason is the amount of satisfaction which we get through food is of only one minute or two. But the satisfaction which we can get through the knowledge is of life long.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4474
    
    6

One technique I would use is triangulation. Put some kind of test output in the JSP and check for it in the "blank" page using the "view page source" option in your browser. Try to put the test output in different places on the JSP. If the test output appears when you put in in one place of the JSP and not in others, you may have some misbehaving code in your JSP that's causing the problem. Next, you can check the Struts components (which version of Struts?) to see what they are doing. Make sure that the declarations of the mappings, forms, and exception handlers can be fully connected. That is, the action is mapped to the right form and possibly the right exception handler. Also make sure the right dispatch methods are getting called and that the expected ActionForwards are getting returned. Check that the right exceptions are getting caught and which exceptions would not get caught. If exceptions are caught, make sure there is at least a log statement for it. Don't leave empty catch blocks laying around. They not only swallow exceptions, they also swallow the telltale signs of bugs. Put some logging statements in strategic places of the Action classes and the classes that it collaborates with. Create as many data points as you can and set expectations. If there are any expectations that are not met, then those are the areas of the code that I would be looking at. So in summary, here are some of the points from which you can triangulate to isolate the location of the problem:

1. JSP - output statements
2. Log statements along the paths in the Java code that you think are getting executed
3. Exceptions - are there any exceptions that are getting swallowed up? I see this in bad code all the time. Add more logging statements.
4. Struts action mappings, action forwards, exception handling - check those to make sure you can connect all the interesting ones together.

Good luck.


Junilu - [How to Ask Questions] [How to Answer Questions]
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 859



Have your DB team look into this. If the exception is getting bubbled up to the servlet layer, this would explain the "empty" page.

WP
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4474
    
    6

OOoh, a database deadlock is more often results from something being done by application code rather than anything on the database, unless the system is using stored procedures and the like. Yeah, get help from the DB team but start looking at what could be causing the deadlock from the application side.
Antonio Walls
Greenhorn

Joined: Jun 12, 2012
Posts: 5
Thanks all, looking into the deadlock issue more tonight. It seems that would explain why it works sometimes and not others...
 
GeeCON Prague 2014
 
subject: Page works sometimes, but sometimes no HTTP response, blank page