felix-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Anthony Bargnesi (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (FELIX-3576) iPOJO fails when using constructor injection and expecting BundleContext in ctor
Date Wed, 17 Oct 2012 12:24:03 GMT

    [ https://issues.apache.org/jira/browse/FELIX-3576?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13477812#comment-13477812

Anthony Bargnesi commented on FELIX-3576:

A similar issue is still occurring.  If I define a component with a constructor that takes
another required component and a BundleContext then I receive the following stacktrace:
  [2012-10-16 16:11:11.886] ERROR iLogServiceListener@65284069 org.osgi.service.log.LogService
Bundle person.impl_0.1.0, [ERROR] person.impl.DefaultPersonService : null 
        java.lang.NullPointerException: null
            at org.apache.felix.ipojo.InstanceManager.handleBCInjections(InstanceManager.java:253)
            at org.apache.felix.ipojo.InstanceManager.configure(InstanceManager.java:207)
            at org.apache.felix.ipojo.ComponentFactory.createInstance(ComponentFactory.java:178)
            at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:310)
            at org.apache.felix.ipojo.IPojoFactory.createComponentInstance(IPojoFactory.java:239)
            at org.apache.felix.ipojo.InstanceCreator$ManagedInstance.create(InstanceCreator.java:355)
            at org.apache.felix.ipojo.InstanceCreator.addInstance(InstanceCreator.java:89)
            at org.apache.felix.ipojo.Extender.parse(Extender.java:306)
            at org.apache.felix.ipojo.Extender.startManagementFor(Extender.java:237)
            at org.apache.felix.ipojo.Extender.access$600(Extender.java:52)
            at org.apache.felix.ipojo.Extender$CreatorThread.run(Extender.java:769)
            at java.lang.Thread.run(Thread.java:

An example component definition that reveals this issue is:

    public class DefaultUserService implements UserService {

    public class DefaultPersonService extends ObjectService implements PersonService {

        private final BundleContext ctx;

        public DefaultPersonService(BundleContext ctx,
            @Requires(nullable = false, proxy = false) UserService userService) {

            this.ctx = ctx;
> iPOJO fails when using constructor injection and expecting BundleContext in ctor
> --------------------------------------------------------------------------------
>                 Key: FELIX-3576
>                 URL: https://issues.apache.org/jira/browse/FELIX-3576
>             Project: Felix
>          Issue Type: Bug
>          Components: iPOJO
>    Affects Versions: ipojo-core-1.8.2
>            Reporter: Daan de Wit
>            Assignee: Göktürk Gezer
>             Fix For: ipojo-core-1.8.4
> When using constructor inject, and also expecting BundleContext to be passed into the
constructor, iPOJO gives and error: The constructor parameter 0 is not managed
> The constructor is defined as something like this:
> public Constructor(BundleContext context, @Requires(id="my-id") Dependency1 dep) { /*
... */ }

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

View raw message