try {
Class clazz = Class.forName(getClassName(), true,
Thread.currentThread().getContextClassLoader());
Constructor constructor =
clazz.getConstructor(new Class[]{String.class});
Object o = constructor.newInstance(new Object[]{principalName});
return (Principal) o;
} catch(Exception ex) {
RuntimeException e = new RuntimeException();
e.initCause(ex);
throw e;
}