This was a partial set-up issue. The EAR classloader was set to PARENT_LAST, but the WAR classloader was not. Once we made it PARENT_LAST in both the places, it worked.
Putting this as an answer so that others having the same issue can find what fixed it from the answer than having to read comments.
If this is a bad etiquette, this can be deleted.