If the security manager is set, resolve the class inside a priviledged access block  JIRA: https://issues.jboss.org/browse/HORNETQ-1357

This is a rebase of Jeff's original PR at https://github.com/hornetq/hornetq/pull/1670 since there was a mistake on his original PR (infinite loop on ObjectInputStreamWithClassLoader). Some small typo that I fixed on this one here.