> On 2025 Aug 13, at 20:27, Daniel Schwartz <d...@danielgschwartz.com> wrote: > > Chris, > > See my reply to your comment. > > Dan > -----Original Message----- > From: Christopher Schultz <ch...@christopherschultz.net> > Sent: Wednesday, August 13, 2025 2:21 PM > To: users@tomcat.apache.org > Subject: Re: [EXTERNAL EMAIL] RE: How to access a REST service > > Application servers don't work that way. A failed request stops the request, > not the application. If the JVM quits when you run out of connections, this > is a very unusual configuration you are running under. > > DGS: I think we miscommunicated. Someone was suggesting that my problem was > that my Java program was throwing exceptions before it released the database > connections, but this can't be possible, because if an exception was being > thrown then either (1) the exception is caught and an error message is > printed out, and the program keeps running, or (2) the error is not caught > and the JVM outputs a stack trace and terminates. Neither of these ever > happened, indicating that no exceptions are being thrown. The only time the > program quits is when Glassfish can't make any further connections. In this > case it is Glassfish that quits, not the JVM.
Uhhh - no. (BTW, the term “program” is rather ambiguous and really has little meaning in a servlet container environment,) Exceptions can also be caught and swallowed, with or without logging them first. An uncaught exception results in termination of a single thread, not the entire JVM process (unless it’s the main thread). Tomcat goes to great lengths to catch any exception that servlet code doesn’t, and returns an appropriate status to the client that initiated the request that encountered the exception. Tomcat normally logs exceptions it catches to the webapp’s log file, not the console (or catalina.out). There has been the rare Tomcat bug where logging was inadvertently skipped. I have no idea what Glassfish does with exceptions, but I would hope that a simple exception in a servlet running under Glassfish would not result in JVM termination - that would be really, really stupid and a violation of the servlet spec. Not sure what you mean by “Glassfish quits, not the JVM” - if Glassfish exits, the JVM process terminates (unless Glassfish is being used in embedded mode). Do you mean that it’s Glassfish that detects the error and exits rather than the JVM aborting with, for example, a segfault ("access violation" in Windows)? - Chuck --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org