Fixes to correct some issues fromport of changes from 3.10.

More fixes to the jboss 5 build - now completes succesfully.