Unable to register shutdown hook because JVM is shutting down
If you are using log4j2 in your project and has been added this one in your classpath and getting below exception while stopping the applicaiton:
Unable to register shutdown hook because JVM is shutting down
- Solution: This happens if you are using ShutDownHook as example below but in your application ShutDownHook machanism could be different don’t take below example seriously it’s just an example:
Runtime.getRuntime().addShutdownHook(new Thread(new Runnable() { @Override public void run() { logger.info("OptionExpiryApplication Exiting."); ((AbstractApplicationContext) context).close(); } }));
How to fix it:
- Go to your log4j2.xml file and specify shutdownHook=”disable” as below:
<?xml version="1.0" encoding="UTF-8"?> <Configuration status="INFO" shutdownHook="disable"> ... </Configuration>
For more information please visit log4j documentation here
Hello ,
Where do I find log4j2.xml, I am getting this as error as above : “2016-06-15 17:14:18,216 FATAL Unable to register shutdown hook because JVM is shutting down.” .
While running yahoo benchmark for storm.