OPENJPA-1384:

Try current classloader when loading DBDictionary.
Submitted By: B.J. Reed

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@881613 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2009-11-17 23:09:57 +00:00
parent ee30b010dc
commit 27996efb48
1 changed files with 12 additions and 0 deletions

View File

@ -154,6 +154,18 @@ public class DBDictionaryFactory {
DBDictionary.class)));
dict = (DBDictionary) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c));
} catch (ClassNotFoundException cnfe) {
// if the dictionary was not found, make another attempt
// at loading the dictionary using the current thread.
try {
Class c = Thread.currentThread().getContextClassLoader().loadClass(dclass);
dict = (DBDictionary) AccessController.doPrivileged(
J2DoPrivHelper.newInstanceAction(c));
} catch (Exception e) {
if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException) e).getException();
throw new UserException(e).setFatal(true);
}
} catch (Exception e) {
if (e instanceof PrivilegedActionException)
e = ((PrivilegedActionException) e).getException();