Skip to content

Commit

Permalink
NXP-8730: reset context class loader for accessing to the naming context
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephane Lacoin committed Jan 25, 2012
1 parent 7a378ef commit 4c1d1c1
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,14 @@ public class RepositoryStatus implements RepositoryStatusMBean {

protected List<RepositoryManagement> getRepositories() throws NamingException {
List<RepositoryManagement> list = new LinkedList<RepositoryManagement>();
InitialContext context = new InitialContext();
InitialContext context;
ClassLoader cl = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(RepositoryStatus.class.getClassLoader());
try {
context = new InitialContext();
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
// we search both JBoss-like and Glassfish-like prefixes
// @see NXCore#getRepository
for (String prefix : new String[] { "java:NXRepository", "NXRepository" }) {
Expand Down

0 comments on commit 4c1d1c1

Please sign in to comment.