try
{
// set the context class loader to that of the realm.
Thread.currentThread().setContextClassLoader(
realm.getClass().getClassLoader());
uroles = realm.authenticate(req.getMethod(), header);
}
finally
{
Thread.currentThread().setContextClassLoader(cl);
}