Results 1 to 3 of 3

Thread: ReflectionUtils.invokeMethod

  1. #1
    Join Date
    Oct 2012
    Posts
    2

    Default 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?

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,624

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Oct 2012
    Posts
    2

    Default

    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
  •