glassfish
  1. glassfish
  2. GLASSFISH-10658

Cannot define a bean in a portable extension.

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: V3
    • Fix Version/s: V3
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      10,658

      Description

      I am trying to implement a portable extension as explained in JSR 299. It is a very simple usecase.

      My test httpservlet contains an @inject as follows.

      <snip>
      @Inject ABeanInterface bean;
      </snip>

      The portable extension would then define the ABeanInterface and its implementation. As defined in
      the chapter 11.5.2, the portable extension would add an implementation Bean<?> interface to
      the AfterBeanDiscovery event with the bean definition.

      But injection to http servlet always fails with the following exception.

      Caused by: javax.enterprise.inject.UnsatisfiedResolutionException: interface
      org.glassfish.test299.ABeanInterface; binding types = [@Default]Unable to resolve any Managed Beans
      at org.jboss.weld.BeanManagerImpl.getBean(BeanManagerImpl.java:996)
      at org.jboss.weld.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:966)
      at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:78)
      at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:683)
      at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:695)
      at org.jboss.weld.SimpleInjectionTarget$1.proceed(SimpleInjectionTarget.java:108)
      at org.glassfish.weld.services.InjectionServicesImpl.aroundInject(InjectionServicesImpl.java:123)
      at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:47)
      at org.jboss.weld.SimpleInjectionTarget.inject(SimpleInjectionTarget.java:102)
      at org.glassfish.weld.services.JCDIServiceImpl.createManagedObject(JCDIServiceImpl.java:174)
      at
      com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBe
      an(ManagedBeanManagerImpl.java:456)
      at
      com.sun.enterprise.container.common.impl.managedbean.ManagedBeanManagerImpl.createManagedBe
      an(ManagedBeanManagerImpl.java:423)
      at
      com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionM
      anagerImpl.java:295)

      Let me know, if you need the test to reproduce this.

      1. ee6testframework.tar
        40 kB
        binod
      2. frameworktest.jar
        4 kB
        rogerk
      3. testwar.tar
        20 kB
        binod

        Activity

        Hide
        binod added a comment -
        Show
        binod added a comment - Filed a JIRA issue. https://jira.jboss.org/jira/browse/WELD-233
        Hide
        rogerk added a comment -

        I;ve verified that this works with the latest build of weld (from trunk).
        It should be fixed in the next integration. I'm reattaching the jar since I had
        to change an import for a changed weld class (AnnotationLiteral).

        Show
        rogerk added a comment - I;ve verified that this works with the latest build of weld (from trunk). It should be fixed in the next integration. I'm reattaching the jar since I had to change an import for a changed weld class (AnnotationLiteral).
        Hide
        rogerk added a comment -

        Created an attachment (id=3786)
        xtension jar containing the correct import for AnnotationLiteral

        Show
        rogerk added a comment - Created an attachment (id=3786) xtension jar containing the correct import for AnnotationLiteral
        Hide
        binod added a comment -

        Could you please let me know, which GF build can I use to test this and continue with my further
        prototyping?

        Show
        binod added a comment - Could you please let me know, which GF build can I use to test this and continue with my further prototyping?
        Hide
        binod added a comment -

        I tested with 11/13 nightly.

        Show
        binod added a comment - I tested with 11/13 nightly.

          People

          • Assignee:
            rogerk
            Reporter:
            binod
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: