Robert (Turner), Rob (Sargent), Chuck (Caldarale), I think our emails are crossing. You are here replying to some earlier replies from me. I just sent another one today with more details.
In any case, I was not aware that a REST webservice had anything to do with servlets, so probably I'm the one that's confused. I guess that I misspoke when I said that it was a "regular Java program", since it doesn't have a main method. It simply sits in the Glassfish domain and responds to REST requests. Does this make it a servlet? I have written servlets before, but this is not how I did it. Robert has asked a lot of questions. I will respond to these as best I can in a future reply. Thanks to everyone for your attention to this. I too would like to get to the bottom of this. Dan -----Original Message----- From: Robert Turner <rtur...@e-djuster.ca.INVALID> Sent: Thursday, August 14, 2025 6:15 PM To: Tomcat Users List <users@tomcat.apache.org> Subject: Re: [EXTERNAL EMAIL] How to access a REST service (apologies for the top post -- this thread is getting messy) I assume you mean JAX-RS (or similar). As a few poeple have already pointed out, these are Servlets under the covers -- regardless, what you have described still has conflicting statements: - you state it's regular Java program (implies it has a main function) - you state it's a WAR file created in IntelliJ (implies it is a Servlet-based application -- whether you are using REST, JSP or others) Those are conflicting statements and why we have been getting very confused. Based on some of your most recent comments, I believe you are using standard Servlet packaging (WAR file), and you are definitely using Servlets under the covers, whether you wrote the Servlet class or not. So, as you said in the email to Chris, you still have this bizarre DB connection issue. Let's see if we can get to the bottom of that...no need to discuss the "client-portion" of the program -- let's focus on just the operations (HTTP operations) that go to your server. As I've said before, I do not expect this is an issue with Glassfish ("select isn't broken"), and that something you have done in setting up either the pool, or the rest endpoints is causing the problem. Here's a list of specific questions that would be helpful to have answers to (actual answers with data from logs, or code samples, etc.) Q1: Are you able to post the code for a single "REST endpoint" (without the business logic), and any classes it uses? This would be much more precise and less prone to communication issues. Q2: It's also not clear what analysis has been done on SQL connection usage? Q3: Do you have logs from your program showing SQL connections acquisition in relation to client requests? Q4: Have you done any analysis by reducing the pool size to the minimum and invoking single REST requests (without the client code .. it's not important to this problem)? Q5: What do you see in terms of connection usage? If you "graphed the count", do you get something like this (fixed width font needed): ___ DB connection count over time: __/ \__ REST request: +-----+ If not, then you want to look at when the connection is released back to the pool. You also haven't provided any information about how the requests you see coming into your server relate to the SQL connections. It would be helpful to have some correlation of these so as to provide suggestions. Q6: Can you provide some data around the number of REST requests your server is receiving per minute (or some period) that correlates to how quickly your session pool was overflowing before you increased the size to 1000? Q7: Could you share your pool connection configuration details? It would be helpful to know if there are "idle periods" (like after release) or "connection test" operations that might be causing some of your issues. Q8: Can you reproduce your pool overflow condition on your development computer with a low pool count and share the Glassfish logs leading up to and including the exception? Q9: Can you share your WEB.INF file that's packaged in your WAR file? Robert On Thu, Aug 14, 2025 at 5:42 PM Daniel Schwartz <d...@danielgschwartz.com> wrote: > 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? >