This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Servlet crash every morning, was working ok before I went to sleep

 
Frankie Chee
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Help!

I got my codes running on both locally and also on the webhoster's website. Tested many times. However each morning when I woke up and test it again the servlet crashed! Everytime I have to get the webhoster to restart the tomcat at their side. But the problem is they are not working on Saturdays or Sundays. Note that the problem occurs each morning!

I encounter HTTP Status 500. The problem associated with servlets that crash or return improperly formatted header. However I had already run and tested the codes locally many times, so that shouldn't be the problem right?

So what could be the problem??:



[ July 09, 2004: Message edited by: Frankie Chee ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

So when you look at line 89 of the servlet code the JSP compiler created, what do you see?

Bill
 
Frankie Chee
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bill,

I presume you are referring to customerB.jsp. But customerB.jsp was already working fine the previous day, hence I felt the problem is not the coding in customerB.jsp.

I got this error every morning for the past 2 days. Note that the problem disappears after the engineers restart tomcat. So I really don't understand what's wrong now.

Please point out my mistakes, thanks in advance.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it worked fine yesterday, but today you have a problem. The problem is on line 89. What is on that line? The container is pointing out the mistake for you.
 
Frankie Chee
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There is nothing there. customerB.jsp only had 52 lines on my textpad. It must be referring to line 89 of something else I dont know.
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
it is referring to the *source code* file that Tomcat creates from your JSP file.

Search in the $CATALINA_HOME/work directory for customerB_jsp.java (it will be in a subdirectory of the work directory). What is happening at or around line 89 of this file?
 
Frankie Chee
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys,

thanks for the pointers, this might help us to get closer to the problem.

I had 3 files, customerA_jsp, customerB_jsp, engineer_jsp. I took a look at the compile JSP codes. The error messages are all pointing at the same problem which is the iterator for a vector.



It's strange as it occurs every morning. But once the server is restarted, the problem disappears.

Throughout the night while we are asleep, no one is able to access the web application because we are the only ones accessible to it as of now.

Could it be that tomcat or linux-apache disable some settings automatically after the application is passive after a long period of time(7 hours)? And thats why we were able to access the web application in the morning?

[ July 13, 2004: Message edited by: Frankie Chee ]
[ July 14, 2004: Message edited by: Frankie Chee ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13064
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The only cause I can think of for that exception is that the request has no attribute named "customerList" - you should insert a check for v == null before trying to do anything with it.
Since request objects can only get an attribute when it has been set by another program handling the request and using forward or include, I would look at where that is supposed to have been set.
Bill
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
is customerList populated from a database ?

is it mysql?

If so, mysql will close connections after 8 hours of inactivity. search here or on google for 'mysql autoreconnect'
 
Frankie Chee
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not sure whether it's because I had rename Vector into ArrayList or was it because the server administrator changes some settings in MySqld, the problem stop for the past 2 mornings.

Thanks for the clues!!
 
Frankie Chee
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Vector known for any issue like this?

I read from text books which suggest ArrayList is newer and has better performance than Vector?
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ArrayList is the newer API, and should be used in almost all cases where you used to use Vector. I wouldn't know if a Vector is "known" for problems like "this", because we haven't established what "this" is.

The most likely cause is the database connections.

Also.. this should have registered as a SQLException, so perhaps the code that does the database work is being too silent on this type of Exception
The above code, or code like it, would produce the error you've encountered.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic