tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Panagiotis Konstantinidis <pa...@hotgen.com>
Subject RE: More Tomcat problems.
Date Mon, 04 Dec 2000 12:10:35 GMT
  Dave, I do not know if you saw the last e-mail I sent to the list. If not
then the bit of code that causes all the trouble is:

        try
        {
            // Load the database's drivers.
            Class.forName("org.gjt.mm.mysql.Driver");
            System.out.println("Class org.gjt.mm.mysql.Driver loaded
successfuly");
            
            // Obtain connection with the database.
            Connection
dbcon=DriverManager.getConnection("jdbc:mysql://isle:3306/footballtest",
"<name>", "<password>");
            System.out.println("Connection with the database
jdbc:mysql://isle:3306/footballtest established");
            
        }
        // If driver not found.
        catch (ClassNotFoundException cnfe)
        {
            System.out.println("Class org.gjt.mm.mysql.Driver not found. ");
            cnfe.printStackTrace();
        }
        // If connection cannot be made.
        catch (SQLException sqle)
        {
            System.out.println("Connection to the databse
jdbc:mysql://isle:3306/footballtest could not be established.");
            sqle.printStackTrace();
        }

    As you see on the above code I catch both ClassNotFound and
SQLException. The "bad" line that causes Tomcat to just go off is the
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://isle:3306/footballtest",
"<name>", "<password>");
    I have to say here that I tried EXACTLY THE SAME CODE in a class
(non-servlet) and it works perfectly and faultless. So the problem must be
somewhere in my Tomcat configuration (otherwise it would not work in a class
as well).

   Any more suggestions?

  Thank you.
  
    Panos


> -----Original Message-----
> From: Dave Smith [mailto:sat-guru@home.com]
> Sent: 03 October 2000 18:35
> To: tomcat-user@jakarta.apache.org
> Subject: Re: More Tomcat problems.
> 
> 
> Endre,
> 
> Tomcat isn't "crashing", it's doing what it is supposed to,
> namely passing an exception on up the handler chain.
> Other servlets and JSP continue to operate normally.
> This is the opposite of "crashing." Scalability depends
> on reliable exception handling.
> 
> The point of my post was to suggest Panagiotis try
> debugging his base code before putting it into the servlet
> runner, then blaiming tomcat/apache for "not reporting
> the error" when his code fails. The servlet runner itself
> is actually pretty stable, not to talk about apache, which
> is rock solid.
> 
> Regards,
> 
> Dave
> ----- Original Message -----
> From: "Endre StĂžlsvik" <Endre@Stolsvik.com>
> To: <tomcat-user@jakarta.apache.org>
> Sent: Sunday, December 03, 2000 1:02 PM
> Subject: Re: More Tomcat problems.
> 
> 
> > On Mon, 2 Oct 2000, Dave Smith wrote:
> >
> > | More Tomcat problems.Panagiotis,
> > |
> > | Are you using a try block around the code to catch SQLExceptions
> > | in your development setup?
> > |
> > | This is what is happening: you are throwing an exception without
> > | a handler. The jvm just unwinds to the top and drops you out.
> >
> > I'm just curious; isn't this strange behaviour? Could a 
> "bad" servlet
> > crash Tomcat totally, then? I'm thinking of virtual servers, several
> > domains sharing a Tomcat.
> >
> >
> > --
> > Mvh,
> > Endre
> >
> 

Mime
View raw message