20

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.

Lucas Oliveira
  • 833
  • 1
  • 10
  • 24

7 Answers7

10

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.

Ayush Nigam
  • 421
  • 7
  • 15
3

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

           closeMethod="close"/>
komarios
  • 147
  • 4
1

In my case I had @Enumerated annotation on string type.

@Enumerated(EnumType.STRING)
@Column(nullable = false, name = "transaction_type")
private String transactionType;

I removed the @Enumerated line as I was using plain string and it WORKED.

Sami Haroon
  • 869
  • 10
  • 14
1

In my case, I removed org.springframework.boot:spring-boot-devtools from gradle.build and it worked with SpringBoot "2.3.7"

Seems like SpringBoot version "2.2" is not impacted.

I have no idea it does this

Martin Brisiak
  • 3,872
  • 12
  • 37
  • 51
0

In my case, this symptom was caused because:

  • I changed my still evolving flyway script (making sure it would run again, by removing its record from the flyway history table),
  • but forgot to drop the table that my script created in my previous testing, and that it was going to create again.

The problem disappeared once I:

  • not only removed the script record from the flyway history table (so that the script would run again)
  • but also reverted the DB schema to its pre-script state
bmel
  • 21
  • 3
0

Looking through answers seems no one answered original question which was about shutdown, not about startup. On this link you can read more about shutdown case which tells us we can ignore those warnings in most of the cases: https://backstage.forgerock.com/knowledge/kb/article/a55893580

horvoje
  • 643
  • 6
  • 21
0

In my case, I didn't add @Id annotation for one of the Entity.That was causing the problem