exec-maven-plugin - 1.6.0
Spring - 5.1.5
com.oracle:ojdbc7 - 12.1.0.2
I have a simple Java class which initiates a Spring AnnotationConfigApplicationContext
which contains a DriverManagerDataSource
(oracle database). The class then inserts a few rows before calling the context.close()
method.
This works great when I run the class from my Intellij. However when I run this via the exec-maven-plugin I get the following error
[WARNING] thread Thread[oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser,4,MYCLASS] was interrupted but is still alive after waiting at least 14999msecs
[WARNING] thread Thread[oracle.jdbc.driver.BlockSource.ThreadedCachingBlockSource.BlockReleaser,4,MYCLASS] will linger despite being asked to die via interruption
[WARNING] NOTE: 1 thread(s) did not finish despite being asked to via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=MYCLASS,maxpri=10]
There are some links on memory leaks around ThreadedCachingBlockSource class but nothing specific on what I have to do.
This only happens when I run via the exec-maven-plugin and NOT when I say right click and run the class in Intellij
I have tried calling explicitly DriverManager.getDrivers
and deregisterDriver
that does not help
After debugging it appears this is nothing to do with ojdbc but everything to do with the exec maven plugin.
As explained in https://github.com/camelinaction/camelinaction2/issues/52 adding -Dexec.cleanupDaemonThreads=false
fixed the problem