[jboss-jira] [JBoss JIRA] (WFLY-9425) EJB no-interface view, non-public method behaviour

Matej Novotny (JIRA) issues at jboss.org
Mon Oct 9 07:08:00 EDT 2017


Matej Novotny created WFLY-9425:
-----------------------------------

             Summary: EJB no-interface view, non-public method behaviour
                 Key: WFLY-9425
                 URL: https://issues.jboss.org/browse/WFLY-9425
             Project: WildFly
          Issue Type: Bug
          Components: EJB
    Affects Versions: 11.0.0.CR1, 10.1.0.Final
            Reporter: Matej Novotny
            Priority: Minor


First of all, I am not sure whether this is bug or a feature.

This is based on a [SO question|https://stackoverflow.com/questions/46602452] - {{@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_):
bq. 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|https://github.com/manovotn/core/commit/e5fca57be714267154c71b442a99d84ecdbf6860] 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|https://github.com/weld/core/blob/2.3/impl/src/main/java/org/jboss/weld/util/reflection/Reflections.java#L429] and I suppose it's there for a reason.



--
This message was sent by Atlassian JIRA
(v7.2.3#72005)



More information about the jboss-jira mailing list