ReflectionUtils.invokeMethod
Hi,
In org.springframework.osgi.util.internal.ReflectionU tils #invokeMethod(java.lang.reflect.Method, Object, Object[])
Java is throwing an exception in: return method.invoke(target, args);
This only happens when spring passes a Proxy class as the target. At the moment as a workaround I just make sure that spring do not proxy these classes. In my case it happens when using:
<osgi:list id="plugins" cardinality="0..N" interface="com.blah.blah.Plugin">
<osgi:listener bind-method="registerPlugin" unbind-method="unregisterPlugin" ref="pluginManager" />
</osgi:list>
pluginManger is proxied and is the target in the method above.
The exception below:
threw exception when passing service type [$Proxy143]
java.lang.IllegalArgumentException: object is not an instance of declaring class
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)[:1.7.0_07]
at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:57)[:1.7.0_07]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:43)[:1.7.0_07]
at java.lang.reflect.Method.invoke(Method.java:601)[:1.7.0_07]
at org.springframework.osgi.util.internal.ReflectionU tils.invokeMethod(ReflectionUtils.java:108)[90:org.springframework.osgi.core:1.2.1]
Any idea if this is a bug?