Update ClassLoaderModelResolver to use the thread context classloader as the parent if its available and its not Equinox, so it works when Tuscany jars are outside of the application
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@778343 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0c9e426056
commit
0251f1173c
1 changed files with 12 additions and 1 deletions
|
@ -48,7 +48,18 @@ public class ClassLoaderModelResolver extends URLClassLoader implements ModelRes
|
|||
private Map<String, ModelResolver> importResolvers = new HashMap<String, ModelResolver>();
|
||||
|
||||
private static ClassLoader parentClassLoader() {
|
||||
ClassLoader parentClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader();
|
||||
ClassLoader parentClassLoader = null;
|
||||
|
||||
// FIXME: Need a better way to not use the ThreadContextClassLoader when running in Equinox
|
||||
if (Thread.currentThread().getContextClassLoader() != null) {
|
||||
if (!"org.apache.tuscany.sca.extensibility.equinox.EquinoxServiceDiscoverer".equals(ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getName())) {
|
||||
parentClassLoader = Thread.currentThread().getContextClassLoader();
|
||||
}
|
||||
}
|
||||
if (parentClassLoader == null) {
|
||||
parentClassLoader = ServiceDiscovery.getInstance().getServiceDiscoverer().getClass().getClassLoader();
|
||||
}
|
||||
|
||||
return parentClassLoader;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue