Commit 7ffa2b78 authored by Andre Freyssinet's avatar Andre Freyssinet

Fix a class loader side-effect of the evolution of versions of Felix,

Jetty and Jersey.
parent 8e68db05
/*
* JORAM: Java(TM) Open Reliable Asynchronous Messaging
* Copyright (C) 2016 - 2017 ScalAgent Distributed Technologies
* Copyright (C) 2016 - 2020 ScalAgent Distributed Technologies
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -268,9 +268,17 @@ public class Helper {
public synchronized Object lookup(String name) throws NamingException {
if (logger.isLoggable(BasicLevel.DEBUG))
logger.log(BasicLevel.DEBUG, "Helper.lookup " + name);
if (ictx == null)
ictx = new InitialContext(jndiProps);
return ictx.lookup(name);
ClassLoader originalContextClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
if (ictx == null)
ictx = new InitialContext(jndiProps);
return ictx.lookup(name);
} finally {
Thread.currentThread().setContextClassLoader(originalContextClassLoader);
}
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment