Hi all,

I'm using apache aries 0.3.2 and I was trying to load a script from the bundle 
like this:

<bean id="script" factory-ref="blueprintBundle" factory-method="getEntry">
       <argument value="scripts/myScript"/>
</bean>

But it fails with this nice 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.

I was wondering  if using the blueprintBundle (or context/container) directly 
as a factory bean is legal and this should work?
or is my current workaround (inject the bundle in a  wrapper bean and  
delegating the lookup to this bean) the way to go?


Kind regards,

Johan Huylebroeck

http://www.i8c.be/integr8-consulting



Reply via email to