I came across this too and having debugged the code (4.2.x, but the code appears to exist unmodified in master, but I have no had the time to debug) it looks like the issue is that the JNDI listener can never be bound because of a ClassCastException which is what triggers the message "Could not bind JNDI listener" to be logged. The cause is that SessionFactoryRegistry.addSessionFactory calls JNDIServiceImpl.addListener(String jndiName, NamespaceChangeListener listener) which attempts to cast the InitialContext instance to EventContext which it isn't an instance of, so will always fail. Therefore the unbind is always going to fail too. |