wood burning stoves 2.0*
The moose likes Servlets and the fly likes Tomcat/MS Access and Tomcat keeps dying Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Tomcat/MS Access and Tomcat keeps dying" Watch "Tomcat/MS Access and Tomcat keeps dying" New topic
Author

Tomcat/MS Access and Tomcat keeps dying

L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
I'm running windows 2000 server and Tomcat and MS Access.
I have written my first JSP that is reading data from an Access database. It works beautifully (displays the data like it should), except tomcat shuts down (dies, crashes, etc) every time I invoke the page.
Please tell me where to look to determine what is wrong. I have looked in the 'logs' folder of tomcat in files isapi.log, jasper.log, and servlet.log. There are no clues there.
Thank you.
kichu kichu
Ranch Hand

Joined: May 10, 2001
Posts: 59
What is the version of the tomcat that u are using???Is it 3.2?
regards,
kichu
L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
Its 3.2.
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
Start tomcat from your Win2K command prompt and then run your jsp.. The prompt window will display errors as you invoke each jsp page and this may give u a clue.
L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
I have. But when tomcat dies, the window goes away and I see no error messages.
Am I supposed to have a tomcat.log file in my logs folder?
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
doesn't any messages show up there in the first few attempts ? before it dies.. ? Tomcat has some kind of option of logging but I'm not too familiar with tomcat.. Could you post the source code of your jsp here ?
L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
<%
class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
java.sql.Connection connection = java.sql.DriverManager.getConnection("jdbc dbc:Students");
java.sql.Statement statement = connection.createStatement();
java.sql.ResultSet columns = statement.executeQuery("Select * from Basicinfo");
while(columns.next()) {
String name = columns.getString("Name");
String social = columns.getSring("Social");
String email = columns.getString("Email");
%>
<table>
<tr> <td> <%=name %> </td>
<td> <%=social %> </td>
<td> <%=email %> </td>
</tr>
<% } %>
</table>
Maky Chopra
Ranch Hand

Joined: Apr 11, 2001
Posts: 149
The code looks fine.. I belive you can get the tomcat logs by setting some stuff in the server.xml file Here's something I found on the net.. Hope it helps you
see server.xml in tomcat/conf
:add
path="logs/tomcat.log"
to <Logger name="tc_log"...
L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
I did that. The stuff the was showing in the Windows screen is now showing in the log file, but it all appears normal...no error messages.
Mark Simms
Ranch Hand

Joined: Jul 20, 2000
Posts: 36
Your JVM may actually be crashing (an instance of JAVAW.EXE)....
modify your tomcat "start.bat" to include "-verbose" on the call to Javaw.
Next time it crashes, check the JAVAW.EXE console....if you can.
BTW: Did you upgrade Win2000 to SP1 ?

Mark
Phil Hanna
Ranch Hand

Joined: Apr 05, 2001
Posts: 118
Three suggestions:
1. Instead of starting Tomcat with startup.bat, invoke tomcat.bat with a "run" parameter:

This will cause Tomcat to be run from the current window rather than opening a new one (which dies when Tomcat dies). That way, you'll be able to see any error messages or stack traces that otherwise would have flashed by.
2. Divide and conquer: copy your JSP code to a standalone Java class, removing all the web-related syntax. Just run it from within

That way, you don't have to contend with whatever might be going wrong on the web side - just concentrate on the database code.
It's quite likely that the problem relates to the JDBC-ODBC bridge and the ODBC data source. That brings me to the third suggestion:
3. Turn on JDBC logging:
Add this statement just before you create the connection:

This will pump out more than you ever wanted to know about what's happening with the database.
My guess is that one or more of your columns.getString() statements is referring to a field that doesn't exist in the table. Check the spelling and case sensitivity. Also try retrieving by column number (in order) rather than column name. Some ODBC drivers are picky about that.
You should also take care to properly close your connection no matter what, so that the underlying ODBC driver and database are in a known state. If you don't shut down cleanly, you may not be able to connect properly for the next request. A typical pattern for this is the following:

------------------
Phil Hanna
Sun Certified Programmer for the Java 2 Platform
Author of :
JSP: The Complete Reference
Instant Java Servlets
Website: http://www.philhanna.com


Phil Hanna<BR>Sun Certified Programmer for the Java 2 Platform<BR>Author of :<BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072127686/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">JSP: The Complete Reference</A><BR><A HREF="http://www.amazon.com/exec/obidos/ASIN/0072124253/electricporkchop/107-3548162-1137317" TARGET=_blank rel="nofollow">Instant Java Servlets</A>
L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
Thanks for all the suggestions. Our system has been down for several days so I have just now read this. I will try these things and let you know.
L. Riley
Greenhorn

Joined: Mar 20, 2001
Posts: 28
A couple of questions...
Mark....I do not see anything resembling a call to 'Javaw' in my tomcat start.bat....?
Phil....I added the code to turn on JDBC logging, but go nothing. Where should I have seen logging info?
To all: I rebooted my machine and Tomcat is no longer crashing. Now I'm just getting no results from my database read.(and no errors) Any other suggestions would be greatly appreciated...
 
Consider Paul's rocket mass heater.
 
subject: Tomcat/MS Access and Tomcat keeps dying
 
Similar Threads
How to get MS-Access report from jsp or java code and print that report
JSP -> MySQL -> MS Access
how to access data present in excel?
reading from oracle!
MS Access/Oracle