glassfish
  1. glassfish
  2. GLASSFISH-16805

[osgi-cdi] support @Inject @OSGiService Instance<T>

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 3.1
    • Fix Version/s: not determined
    • Component/s: OSGi-JavaEE
    • Labels:
      None

      Description

      Currently having something like
      @Inject @OSGiService(dynamic=true)
      private Instance<AdminService> adminService;

      cause following exception:

      java.lang.UnsupportedOperationException: Injection target type javax.enterprise.inject.Instance<org.glassfish.fighterfish.test.app18.AdminService>not supported
      at org.glassfish.osgicdi.impl.OSGiServiceExtension.afterBeanDiscovery(OSGiServiceExtension.java:185)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:305)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:54)
      at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:163)
      at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:299)
      at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:188)
      at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:59)
      at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:198)
      at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:282)
      at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:265)
      at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:234)
      at org.jboss.weld.bootstrap.events.AbstractContainerEvent.fire(AbstractContainerEvent.java:88)
      at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:52)
      at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:43)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:372)
      at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
      at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:128)
      at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:270)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
      at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
      at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.deploy(OSGiDeploymentRequest.java:183)
      at org.glassfish.osgijavaeebase.OSGiDeploymentRequest.execute(OSGiDeploymentRequest.java:118)
      at org.glassfish.osgijavaeebase.AbstractOSGiDeployer.deploy(AbstractOSGiDeployer.java:121)
      at org.glassfish.osgijavaeebase.OSGiContainer.deploy(OSGiContainer.java:154)
      at org.glassfish.osgijavaeebase.JavaEEExtender.deploy(JavaEEExtender.java:107)
      at org.glassfish.osgijavaeebase.JavaEEExtender.access$200(JavaEEExtender.java:61)
      at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:151)
      at org.glassfish.osgijavaeebase.JavaEEExtender$HybridBundleTrackerCustomizer$1.call(JavaEEExtender.java:148)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)

      at org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire(AbstractDefinitionContainerEvent.java:55)
      at org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl.fire(AfterBeanDiscoveryImpl.java:43)
      at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:372)
      at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:170)
      ... 17 more

      #]

        Activity

        Hide
        Sanjeeb Sahoo added a comment -

        assigning to Siva for evaluation.

        Show
        Sanjeeb Sahoo added a comment - assigning to Siva for evaluation.
        Hide
        Sivakumar Thyagarajan added a comment -

        Tagging this as 3_1-next, as this is not critical for the 3.1.1 release.

        Show
        Sivakumar Thyagarajan added a comment - Tagging this as 3_1-next, as this is not critical for the 3.1.1 release.
        Hide
        Sanjeeb Sahoo added a comment -

        Do you know why it is not working? Can you at least mention the reason?

        Show
        Sanjeeb Sahoo added a comment - Do you know why it is not working? Can you at least mention the reason?
        Hide
        Sivakumar Thyagarajan added a comment -

        Marked it as an improvement(RFE)

        Show
        Sivakumar Thyagarajan added a comment - Marked it as an improvement(RFE)
        Hide
        Tom Mueller added a comment -

        Bulk update to change fix version to "not determined" for all issues still open but with a fix version for a released version.

        Show
        Tom Mueller added a comment - Bulk update to change fix version to "not determined" for all issues still open but with a fix version for a released version.
        Hide
        TangYong added a comment -

        Now, the feature has been supported combined with subTask(GLASSFISH-18978). Please see.

        https://github.com/tangyong/gf-cdi-osgi-integration

        DEMO1: https://github.com/tangyong/gf-cdi-osgi-integration/tree/master/samples/[RFP146]CDI018
        DEMO2: https://github.com/tangyong/gf-cdi-osgi-integration/tree/master/samples/[RFP146]CDI004

        Using Way:

        1 get all osgi services
        @Inject Service<StockQuoteService> sqses;
        ....

        2 get osgi services qualified @ServiceFilter
        @Inject @ServiceFilter("(country=CN)") Service<StockQuoteService> sqses;
        ...

        Show
        TangYong added a comment - Now, the feature has been supported combined with subTask( GLASSFISH-18978 ). Please see. https://github.com/tangyong/gf-cdi-osgi-integration DEMO1: https://github.com/tangyong/gf-cdi-osgi-integration/tree/master/samples/[RFP146]CDI018 DEMO2: https://github.com/tangyong/gf-cdi-osgi-integration/tree/master/samples/[RFP146]CDI004 Using Way: 1 get all osgi services @Inject Service<StockQuoteService> sqses; .... 2 get osgi services qualified @ServiceFilter @Inject @ServiceFilter("(country=CN)") Service<StockQuoteService> sqses; ...
        Hide
        TangYong added a comment -

        After event integration was finished, the feature will start because compared with other features, it has been turned more important.

        Show
        TangYong added a comment - After event integration was finished, the feature will start because compared with other features, it has been turned more important.

          People

          • Assignee:
            Sivakumar Thyagarajan
            Reporter:
            Sanjeeb Sahoo
          • Votes:
            1 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: