I'm working on WFLY-11808 (Unable to do jndi lookup when starting batch job from web console), and would like to get some help from team, especially naming and management experts.
The failure occurred when a batch job is started from management console or CLI, and during the batch job execution it does some jndi lookup. The lookup failed with NameNotFoundException.
In batch subsystem, it assigns the name context for the job execution by calling:
For a management-started job execution, it selected the one associated with the current thread which is an external management request thread, and apparently has no knowledge of the deployment.
Is there a way to select the name context associated with the deployment that contains the batch job?
Unfortunately, there isn't a NamespaceContextSelector for a deployment overall. There's the default selector (which I assume is what NamespaceContextSelector.getCurrentSelector() is returning now for this case) and then there are per-EE-component selectors (see NamespaceConfigurator.configure).
I don't know if what Eduardo Martins is doing on https://issues.jboss.org/browse/WFLY-9529 may help somewhat, i.e. by making some commonly requested bindings visible when the thread is handling a from an EE component.