When I checked found the following code change to fix issue in WebLogic server:
loginContext = new LoginContext(..);
subject = loginContext.login();
subject = weblogic.security.services.Authentication.login(..);
Is there anything like this needed in WildFly?
I had issue when called a static method from a utility class from MDB to instantiate LoginContext. This is fixed when I copied that code to MDB. I don't know what was the actual cause of that issue.