This has been discussed extensively on the mailing list, starting from this thread:
The proper fix requires changes in WildFly; this looks like a sane attempt: