aspose file tools*
The moose likes Tomcat and the fly likes Servlet crash every morning, was working ok before I went to sleep Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Servlet crash every morning, was working ok before I went to sleep" Watch "Servlet crash every morning, was working ok before I went to sleep" New topic
Author

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

Frankie Chee
Ranch Hand

Joined: Oct 26, 2003
Posts: 43
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

Joined: Mar 22, 2000
Posts: 12769
    
    5

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

Bill
Frankie Chee
Ranch Hand

Joined: Oct 26, 2003
Posts: 43
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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Oct 26, 2003
Posts: 43
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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Oct 26, 2003
Posts: 43
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

Joined: Mar 22, 2000
Posts: 12769
    
    5
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

Joined: Feb 20, 2001
Posts: 3695

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

Joined: Oct 26, 2003
Posts: 43
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

Joined: Oct 26, 2003
Posts: 43
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

Joined: Feb 20, 2001
Posts: 3695

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet crash every morning, was working ok before I went to sleep