-
Oct 16th, 2012, 04:38 AM
#1
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?
-
Oct 16th, 2012, 04:47 AM
#2
No it isn't as it is a proxy (and depending on the type of proxy it is indeed not a type of declaring class).
Also why is this in container... This clearly is an Spring DM class and not a Spring class and Spring DM isn't continued anymore and has been donated to the Eclipse foundation.
-
Oct 16th, 2012, 05:05 AM
#3
Thanks, I'll take this to another forum.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules