Upon starting it the second time, the JMS test application tries to reauthenticate before the Datasource is bound to a JNDI name and my LoginModule fails.
What kind of test application is it? Maybe the dependency on the datasource could be added at that level.
My test application simply makes a JMS connection and sends a message every 5 seconds. The problem is that HornetQ's automatic reconnection appears to try to reconnect immediately when it sees the server come back up. But at that point the server has not yet bound the DefaultDS to a JNDI name (which my custom LoginModule requires). This definitely seems like something that should be enforced on the server side, since it deals with the order that various services/components on the server are inititalized.
I know that mbeans can have an explicit dependencies, including on particular datasources. Here's an example snippit:
<!-- other stuff -->
I was hoping that there would be something similar for LoginModules.
For example, does the <login-module> tag in login-config.xml provide some similar syntax? Or is there some other way to ensure that the Datasource is bound to a JNDI name that the LoginModule can lookup before its initialize() method is called?