Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2430

EJB no-interface view, non-public method behaviour

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Minor
    • Resolution: Done
    • Affects Version/s: 3.0.1.Final, 2.4.5.Final
    • Fix Version/s: 3.0.2.Final, 2.4.6.Final
    • Component/s: None
    • Labels:
      None

      Description

      This is based on a SO question - @Stateless no-interface view bean with non-public method. You inject this bean into other bean (using CDI) and try to invoke that non-public method.

      According to EJB spec, this should throw EJBException (chapter Session Bean’s No-Interface View):

      Only public methods of the bean class and of any superclasses except java.lang.Object may be invoked through the no-interface view. Attempted invocations of methods with any other access modifiers via the no-interface view reference must result in the javax.ejb.EJBException.

      I put together a Weld test for this - feel free to browse the code.
      When invoked in Weld, this does not throw EJBException but in fact fails on IllegalAccess when an attempt is made to access that method.
      Note that in Weld code, we are explicitly handling these EJB invocations using a method which does not override accessibility rules and I suppose it's there for a reason.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                manovotn Matej Novotny
                Reporter:
                manovotn Matej Novotny
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: