aries-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Guillaume Nodet (JIRA)" <>
Subject [jira] [Commented] (ARIES-894) Using blueprintBundle as a factory bean for resources throws IllegalAccessException
Date Tue, 31 Jul 2012 16:19:34 GMT


Guillaume Nodet commented on ARIES-894:

I think the patch is wrong in the way it's fixing the problem.
The main reason is that the exact same problem happen with setters and lifecycle methods.
I'm tempted to use a setAccessible(true) call before invoking any public method to cope with
class visibility.
Another way would be to reuse the same mechanism you provided in the patch but in a more generic
way, i.e. rewrite a helper method to execute Class.getMethods() but in a smarter way.
The problem is that Class.getMethods() does the opposite, i.e. it hides all super methods
if those are redefined in the base class.

I'm investigating further...
> Using blueprintBundle as a factory bean for resources throws IllegalAccessException
> -----------------------------------------------------------------------------------
>                 Key: ARIES-894
>                 URL:
>             Project: Aries
>          Issue Type: Bug
>          Components: Blueprint
>    Affects Versions: blueprint-0.3.1
>            Reporter: Johan Huylebroeck
>            Assignee: Guillaume Nodet
>              Labels: patch
>         Attachments: aries-894.patch.gz, aries-894.patch.gz
> I’m using apache aries 0.3.2 and I was trying to lookup a script in the bundle like
> <bean id="script" factory-ref="blueprintBundle" factory-method="getEntry">
>        <argument value="scripts/myScript"/>
> </bean>
> But it fails with this exception:
> java.lang.IllegalAccessException: Class org.apache.aries.blueprint.utils.ReflectionUtils
can not access a member of class org.apache.felix.framework.BundleImpl with modifiers "public"
>                 at sun.reflect.Reflection.ensureMemberAccess([:1.6.0_32]
>                 at java.lang.reflect.Method.invoke([:1.6.0_32]
>                 at org.apache.aries.blueprint.utils.ReflectionUtils.invoke([10:org.apache.aries.blueprint:0.3.2]
>                 at org.apache.aries.blueprint.container.BeanRecipe.invoke([10:org.apache.aries.blueprint:0.3.2]
>                 at org.apache.aries.blueprint.container.BeanRecipe.getInstance([10:org.apache.aries.blueprint:0.3.2]
>                 ... 15 more
> The problem seems to be that the factory method is resolved against the implementation
class BundleImpl which is package private and not the interface org.osgi.framework.Bundle
which is public.
> There is a workaround by injecting the bundle in a wrapper bean and using this bean to
do the lookup.

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:!default.jspa
For more information on JIRA, see:


View raw message