Robert, Please see the reply is just sent to Chris. I think that this answers your questions.
I don't know why people thought I was using servlets. It's a REST web service. I thought that this was clear. Dan -----Original Message----- From: Robert Turner <rtur...@e-djuster.ca.INVALID> Sent: Thursday, August 14, 2025 1:27 AM To: Tomcat Users List <users@tomcat.apache.org> Subject: Re: [EXTERNAL EMAIL] How to access a REST service Oh.... On Thu, Aug 14, 2025, 00:57 Daniel Schwartz <d...@danielgschwartz.com> wrote: > > > > DGS: You are talking above my head on this, but I’m not using any > servlets, and the entire JVM process is the main thread. > > > > DGS: Let me put this in context. My system has two components, (1) a > backend REST webservice written in Java and running in Glassfish, (2) > a website written in Next.js that consumes the webservice. The Java > program access a MySql database through the Glassfish pooling system. > But this is just an ordinary Java program running in a single thread. > If this throws an exception that is caught, then the code for the > catch clause will output an error message, and if it throws an > exception that is not caught, the JRE will output a stack trace and > terminate. You say that Glassfish will somehow “swallow” the > exception and keep running. I really don’t think so. Maybe something > like this will happen with servlets, but this is just an ordinary Java > program, and this is how Java behaves. It has nothing to do with Glassfish. > Now I know why are all so confused .. FWIW, this made me laugh for 3 minutes... Either you've made things much harder for yourself, or you have some good reason for this approach... Typically one would use a server based application with a servlet container (Glassfish or Tomcat). What is acting as your web server/TCP server! Performing your listen / accept / etc on the sockets? Are you using bits of Glassfish as a library? Is there a reference example of what you've built somewhere?