Johan Huylebroeck created ARIES-894:
---------------------------------------

             Summary: Using blueprintBundle as a factory bean for resources 
throws IllegalAccessException
                 Key: ARIES-894
                 URL: https://issues.apache.org/jira/browse/ARIES-894
             Project: Aries
          Issue Type: Bug
          Components: Blueprint
    Affects Versions: blueprint-0.3.1
            Reporter: Johan Huylebroeck


I’m using apache aries 0.3.2 and I was trying to lookup a script in the bundle 
like this: 

<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(Reflection.java:65)[:1.6.0_32]

                at java.lang.reflect.Method.invoke(Method.java:588)[:1.6.0_32]

                at 
org.apache.aries.blueprint.utils.ReflectionUtils.invoke(ReflectionUtils.java:225)[10:org.apache.aries.blueprint:0.3.2]

                at 
org.apache.aries.blueprint.container.BeanRecipe.invoke(BeanRecipe.java:838)[10:org.apache.aries.blueprint:0.3.2]

                at 
org.apache.aries.blueprint.container.BeanRecipe.getInstance(BeanRecipe.java:236)[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: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira


Reply via email to