Hello good afternoon, I ask this question because I have searched a lot on the internet but I have not found a solution to this problem.
The issue is that I start the server and everything goes smoothly, I have several services implemented, PUT and GET services, and when calling them through postman they all return a 200 response, as long as it is the first request after starting the server . That is, the second and subsequent services are lost in limbo, since the connection is accepted by the server.
Of course I have put breakpoints in the services and started the server in "debug-mode" to see if I could get some info but all to no avail.
I attach images of the server console, of the persistence.xml configuration, since I use JPA with Hibernate as the persistence manager, and of the pom.xml. In principle, I think that the JPA annotations are fine, since the ide does not give me any errors and in the first service I add, delete and consult records from the database. Add that I use Jersey as a serializer.
Thank you very much in advance, I hope you can help me. :)
EDIT:
I have managed to isolate the failures, and these are in the GET services, the PUT services work fine. There seems to be some problem with the connection to the database, because when it gets "hanged" if I try to access the database records through the mysql console, the query is not returned until I close the raw server (pressing the "terminate" button) I add the stacktrace of the error below. Thank you very much again.
INFO: HHH10001501: Connection obtained from JdbcConnectionAccess [org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator$ConnectionProviderJdbcConnectionAccess@5eb3a986] for (non-JTA) DDL execution was not in auto-commit mode; the Connection 'local transaction' will be committed and the Connection will be set into auto-commit mode. May 16, 2018 10:06:00 AM org.apache.catalina.core.StandardServer await INFORMATION: A shutdown command was received through the shutdown port. Stopping the Server instance. May 16, 2018 10:06:00 AM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:00 AM org.apache.coyote.AbstractProtocol pause INFO : Pausing ProtocolHandler ["ajp-nio-8009"] May 16, 2018 10:06:00 AM org.apache.catalina.1 instance(s) to retrieve reserved space May 16, 2018 10:06:01 AM org.apache.catalina.core.StandardWrapper unload INFORMATION: Waiting for 1 instance(s) to retrieve reserved space May 16, 2018 10: 06:02 AM org.apache.catalina.core.StandardWrapper unload INFO: Waiting for 1instance(s) to retrieve your reserved space May 16, 2018 10:06:02 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc WARNING: Web application [ILoan] registered JDBC driver [com.mysql.jdbc.Driver] but it failed to unregister while the web app was stopped. To prevent a memory leak, the JDBC driver has been forcibly unregistered. May 16, 2018 10:06:02 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads WARNING: The web application [ILoan] is still processing a request that has yet to finish. This is very likely to create a memory leak. You can control the time allowed for requests to finish by using the unloadDelay attribute of the standard Context implementation. Stack trace of request processing thread:[ java.net.SocketInputStream. The web application [ILoan] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: java.lang.Object.wait(Native Method) java.lang.ref.ReferenceQueue.remove(Unknown Source) com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:43) May 16, 2018 10 :06:02 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads WARNING: The web application [ILoan] appears to have started a thread named [pool-2-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks.LockSupport.parkNanos(Unknown Source) java.util.concurrent.locks. AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread.run(Unknown Source) May 16, 2018 10:06:02 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads WARNING: The web application [ILoan] appears to have started a thread named [pool-3-thread-1] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread: sun.misc.Unsafe.park(Native Method) java.util.concurrent.locks. LockSupport.parkNanos(Unknown Source) java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(Unknown Source) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take(Unknown Source) java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take (Unknown Source) java.util.concurrent.ThreadPoolExecutor.getTask(Unknown Source) java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) java.lang.Thread .run(Unknown Source) May 16, 2018 10:06:02 AM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads WARNING: The web application [ILoan] appears to have started a thread named [pool-4-thread-1] but you have failed to stop it. This is very likely to create a memory leak. Stack trace of thread: ThreadLocal@39c0db85]) and a value of type [org.glassfish.jersey.internal.Errors] (value [org.glassfish.jersey.internal.Errors@42630ea9]) but could not remove it when the web application stopped. The threads will be renewed over time to try to avoid a possible memory leak. May 16, 2018 10:06:02 AM org.apache.catalina.loader.WebappClassLoaderBase checkThreadLocalMapForLeaks FATAL: Web application [ILoan] created a ThreadLocal with key of type [java.lang.ThreadLocal] (value [java.lang.ThreadLocal @23fdc732]) and a value of type [org.glassfish.jersey.process.internal.RequestScope.Instance] (value [Instance{id=37621d2c-f027-4731-b0e6-c0ec9732fb4a, referenceCounter=2, store size=3} ]) but could not remove it when the web application stopped. The threads will be renewed over time to try to avoid a possible memory leak. May 16, 2018 10:06:02 AM org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.tomcat.util.net.AbstractEndpoint shutdownExecutor WARNING: The executor associated with thread pool [http-nio-8080] has not fully shutdown. Some application threads may still be running. May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol stop INFORMATION: Stopping ProtocolHandler ["ajp-nio-8009"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION : Destroying ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION: Destroying ProtocolHandler ["ajp-nio-8009"] Stopping ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.tomcat.util.net.AbstractEndpoint shutdownExecutor WARNING: The executor associated with thread pool [http-nio-8080] has not fully shutdown. Some application threads may still be running. May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol stop INFORMATION: Stopping ProtocolHandler ["ajp-nio-8009"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION : Destroying ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION: Destroying ProtocolHandler ["ajp-nio-8009"] Stopping ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.tomcat.util.net.AbstractEndpoint shutdownExecutor WARNING: The executor associated with thread pool [http-nio-8080] has not fully shutdown. Some application threads may still be running. May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol stop INFORMATION: Stopping ProtocolHandler ["ajp-nio-8009"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION : Destroying ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION: Destroying ProtocolHandler ["ajp-nio-8009"] The executor associated with thread pool [http-nio-8080] has not fully shutdown. Some application threads may still be running. May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol stop INFORMATION: Stopping ProtocolHandler ["ajp-nio-8009"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION : Destroying ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION: Destroying ProtocolHandler ["ajp-nio-8009"] The executor associated with thread pool [http-nio-8080] has not fully shutdown. Some application threads may still be running. May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol stop INFORMATION: Stopping ProtocolHandler ["ajp-nio-8009"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION : Destroying ProtocolHandler ["http-nio-8080"] May 16, 2018 10:06:07 AM org.apache.coyote.AbstractProtocol destroy INFORMATION: Destroying ProtocolHandler ["ajp-nio-8009"]
The problem is the infinite loops that are created in the database queries. When a User has many Friends and a Friend can belong to many Users (One to many and Many to one, bidirectional relationship), if it is not mapped well, infinite loops can be generated that saturate the database. I add this tutorial in which bidirectional relationships are explained very well. This is the best article I have been able to find. Article on two-way relationships
EDIT:
I add a new tutorial. JPA Relations Tutorial