diff --git a/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java b/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java index f5adb241c..3ba005c09 100644 --- a/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java +++ b/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/ProviderImpl.java @@ -577,7 +577,7 @@ protected T createPort(QName portName, EndpointReferenceType epr, Class s ClassLoader origClassLoader = getContextClassLoader(); T port = null; try { - setContextClassLoader(createDelegateClassLoader(origClassLoader, ServiceImpl.class.getClassLoader())); + setContextClassLoader(createDelegateClassLoader(origClassLoader, SecurityActions.getClassLoader(ServiceImpl.class)); port = super.createPort(portName, epr, serviceEndpointInterface, features); } finally { setContextClassLoader(origClassLoader); diff --git a/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SecurityActions.java b/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SecurityActions.java index cae156178..7b6925035 100644 --- a/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SecurityActions.java +++ b/modules/client/src/main/java/org/jboss/wsf/stack/cxf/client/SecurityActions.java @@ -76,6 +76,26 @@ public Object run() }); } } + + static ClassLoader getClassLoader(Class clazz) + { + SecurityManager sm = System.getSecurityManager(); + if (sm == null) + { + return clazz.getClassLoader(); + } + else + { + return AccessController.doPrivileged(new PrivilegedAction() + { + public ClassLoader run() + { + return clazz.getClassLoader(); + } + }); + } + } + /** * Return the current value of the specified system property