In osgi, the bundle that uses a client MAY have imports for some of the cxf stuff (like the Client interface), but not all the params and return types. That causes client creation failures.
Project: http://git-wip-us.apache.org/repos/asf/cxf/repo Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/7bcef9f3 Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/7bcef9f3 Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/7bcef9f3 Branch: refs/heads/2.7.x-fixes Commit: 7bcef9f3cfabfb6848b6a46aadfe099a00c22e34 Parents: a30ca11 Author: Daniel Kulp <[email protected]> Authored: Fri May 8 14:05:08 2015 -0400 Committer: Daniel Kulp <[email protected]> Committed: Fri May 22 15:25:46 2015 -0400 ---------------------------------------------------------------------- .../main/java/org/apache/cxf/common/util/ProxyHelper.java | 10 ++++++++++ 1 file changed, 10 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cxf/blob/7bcef9f3/api/src/main/java/org/apache/cxf/common/util/ProxyHelper.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/cxf/common/util/ProxyHelper.java b/api/src/main/java/org/apache/cxf/common/util/ProxyHelper.java index 27f2c56..89bdad3 100644 --- a/api/src/main/java/org/apache/cxf/common/util/ProxyHelper.java +++ b/api/src/main/java/org/apache/cxf/common/util/ProxyHelper.java @@ -20,6 +20,7 @@ package org.apache.cxf.common.util; import java.lang.reflect.InvocationHandler; +import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** @@ -73,6 +74,15 @@ public class ProxyHelper { if (ifClass != currentInterface) { return false; } + //we need to check all the params/returns as well as the Proxy creation + //will try to create methods for all of this even if they aren't used + //by the client and not available in the clients classloader + for (Method m : ifClass.getMethods()) { + Class.forName(m.getReturnType().getName(), true, loader); + for (Class<?> p : m.getParameterTypes()) { + Class.forName(p.getName(), true, loader); + } + } } catch (NoClassDefFoundError e) { return false; } catch (ClassNotFoundException e) {
