Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The web application appears to have started a thread named [HikariPool-1 housekeeper] but has failed to stop it

I am trying use HikariCP JNDI DataSource Factory within Tomcat 8.5 but when it shutdown I'm getting these warning:

o.a.c.loader.WebappClassLoaderBase       : The web application [ROOT] appears to have started a thread named [HikariPool-1 housekeeper] 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)

My Hiraki configuration was setup following the JNDI DataSource Factory (Tomcat, etc.) document, and is something like this:

<Resource name="******" auth="Container"
      factory="com.zaxxer.hikari.HikariJNDIFactory"
      type="javax.sql.DataSource"
      minimumIdle="5" 
      maximumPoolSize="10"
      connectionTimeout="300000"
      driverClassName="org.postgresql.Driver"
      jdbcUrl="jdbc:postgresql://******"
      dataSource.implicitCachingEnabled="true" 
      dataSource.user="******"
      dataSource.password="******" />

I've found this link but it doesn't help because I'm using Hiraki as a resource inside Tomcat.

I'm using Tomcat 8.5 HikariCP 2.5.1

Any help? Thanks.

like image 471
Lucas Oliveira Avatar asked Jan 24 '17 18:01

Lucas Oliveira


2 Answers

I had faced the exact same problem, at-least the error message was the same. The error message says that there is a problem with Hikari-Pool configuration but actually your Tomcat is failing to start. A simple solution is to check your application for any run-time error. In my case, in my Rest-Controller, I had declared the same HTTP-Method with the same URI endpoint but with different method names. Thus, it wasn't a compile time error but during build of Tomcat it fails, causing HikariPool to throw a error message.

Hope it helps. If this doesn't works do comment, maybe I could help.

like image 112
Ayush Nigam Avatar answered Sep 20 '22 13:09

Ayush Nigam


All you need to add is this at the end of your Resource:

           closeMethod="close"/>
like image 20
komarios Avatar answered Sep 19 '22 13:09

komarios