Weld
  1. Weld
  2. WELD-921

Incorrect handling of business interfaces for EJBs (where defining class of business method is not the Business interface of the EJBs)

    Details

    • Type: Bug Bug
    • Status: Resolved Resolved (View Workflow)
    • Priority: Major Major
    • Resolution: Done
    • Affects Version/s: 1.1.0.Final, 1.1.1.Final
    • Fix Version/s: 2.0.0.Beta8
    • Component/s: Weld SPI
    • Labels:
      None
    • Steps to Reproduce:
      Hide

      Source and an EAR to reproduce this on GlassFish is at http://java.net/jira/browse/GLASSFISH-16186

      Show
      Source and an EAR to reproduce this on GlassFish is at http://java.net/jira/browse/GLASSFISH-16186
    • Bugzilla Update:
      Perform
    • Similar Issues:
      Show 10 results 

      Description

      This is based on the scenario described in http://java.net/jira/browse/GLASSFISH-16186

      • @Named @Stateless TimeProviderImpl extends SimpleTimeProvider implements LocalTimeProvider.
      • SimpleTimeProvider implements TimeProvider (the latter defining some methods, the former implementing them. No annotations.)
      • LocalTimeProvider is @Local and also extends TimeProvider and does nothing more.

      So the Local Business interface is LocalTimeProvider.

      The following injection is performed on a SessionScoped Bean
      @Inject
      private LocalTimeProvider timeProvider1;

      The Weld bean proxy for the SessionBean Object reference being injected(timeProvider1) tries to get [1] the BusinessObject when a method is invoked on it. Weld seems to use [2] the declaring class of the method being invoked to determine the business interface. Though the business interface of the Bean is set to com.dummy.time.LocalTimeProvider, the class that declares the method being invoked ("getThisMonth()") is com.dummy.time.TimeProvider.

      Therefore, the Weld implementation calls SessionObjectReferenceImpl.getBusinessObject("com.dummy.time.TimeProvider"), which fails, as TimeProvider is not a Business interface. As per [3], the businessInterfaceType must be a type of the business interface of the bean. Is Weld incorrect in mapping the method to its declaring interface. Weld must instead use the injected type as the business interface, while trying to get the business object.

      [1] https://github.com/weld/core/blob/76c31d311cf1ff449eb2d5c80943b913651bed96/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java#L123
      [2]https://github.com/weld/core/blob/76c31d311cf1ff449eb2d5c80943b913651bed96/impl/src/main/java/org/jboss/weld/bean/proxy/EnterpriseBeanProxyMethodHandler.java#L146
      [3] https://github.com/weld/api/blob/master/weld-spi/src/main/java/org/jboss/weld/ejb/api/SessionObjectReference.java#L31

        Issue Links

          Activity

          Hide
          Joseph Snyder
          added a comment -

          Will this issue be resolved for 2.0? The test case attached for http://java.net/jira/browse/GLASSFISH-16186 still fails with Weld 2.0.0.Beta6

          Show
          Joseph Snyder
          added a comment - Will this issue be resolved for 2.0? The test case attached for http://java.net/jira/browse/GLASSFISH-16186 still fails with Weld 2.0.0.Beta6
          Hide
          Jozef Hartinger
          added a comment - - edited

          stuartdouglas: A fix that will cover 99% of cases and remove the need for the work around is to create multiple client proxies per EJB, one per business interface
          stuartdouglas: And embed the business interface in a field in the proxy
          stuartdouglas: So the proxy just 'knows' the correct business interface

          Show
          Jozef Hartinger
          added a comment - - edited stuartdouglas: A fix that will cover 99% of cases and remove the need for the work around is to create multiple client proxies per EJB, one per business interface stuartdouglas: And embed the business interface in a field in the proxy stuartdouglas: So the proxy just 'knows' the correct business interface
          Hide
          RH Bugzilla Integration
          added a comment -

          Vaclav Tunka <vtunka@redhat.com> changed the Status of bug 1034776 from NEW to ON_QA

          Show
          RH Bugzilla Integration
          added a comment - Vaclav Tunka <vtunka@redhat.com> changed the Status of bug 1034776 from NEW to ON_QA
          Hide
          RH Bugzilla Integration
          added a comment -

          Tomas Remes <tremes@redhat.com> changed the Status of bug 1034776 from ON_QA to VERIFIED

          Show
          RH Bugzilla Integration
          added a comment - Tomas Remes <tremes@redhat.com> changed the Status of bug 1034776 from ON_QA to VERIFIED
          Hide
          RH Bugzilla Integration
          added a comment -

          mark yarborough <myarboro@redhat.com> changed the Status of bug 1034776 from VERIFIED to CLOSED

          Show
          RH Bugzilla Integration
          added a comment - mark yarborough <myarboro@redhat.com> changed the Status of bug 1034776 from VERIFIED to CLOSED

            People

            • Assignee:
              Jozef Hartinger
              Reporter:
              Sivakumar Thyagarajan
            • Votes:
              4 Vote for this issue
              Watchers:
              14 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: