• 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/MS Access and Tomcat keeps dying

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the version of the tomcat that u are using???Is it 3.2?
regards,
kichu
 
L. Riley
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Its 3.2.
 
Ranch Hand
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
<%
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
Posts: 149
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ?
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
L. Riley
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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...
 
And then the flying monkeys attacked. My only defense was this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic