Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto-link EJB references in java:global with beanName or ejb-link #10453

Closed
tkburroughs opened this issue Jan 15, 2020 · 0 comments · Fixed by #10455
Closed

Auto-link EJB references in java:global with beanName or ejb-link #10453

tkburroughs opened this issue Jan 15, 2020 · 0 comments · Fixed by #10455
Assignees
Labels
bug This bug is not present in a released version of Open Liberty in:EJB Container team:Blizzard

Comments

@tkburroughs
Copy link
Member

Currently, EJB references defined in java:global are required to have a binding in ibm-*-bnd.xml, to link the ejb reference (@EJB, ejb-ref, or ejb-local-ref) to an actual EJB. Primarily this is because ejb-link only works within an application, whereas it has been assumed a ref in java:global will bind to an EJB in a different application.

However, if an EJB definition would like to define a reference to itself in java:global, so that it may make itself available at a non-standard location, then this isn't possible without a binding.

For example:

@Stateless
@Remote(ClientRemote.class)
@EJB(name = "java:global/env/ejb/ClientBeanRef", beanInterface = ClientRemote.class, beanName = "ClientBean")
public class ClientBean {

Would declare an EJB which may be looked up or injected from two locations in JNDI:

Spec defined location : java:global/<app>/<module>/ClientBean!xxx.xxx.ClientRemote
EJB ref location : java:global/env/ejb/ClientBeanRef

Currently, the above definition will fail, unless the ibm-ejb-jar-bnd.xml file is also provided and defines a binding as:

  <session name="ClientBean">
    <ejb-ref name="java:global/env/ejb/ClientBeanRef" binding-name="java:global/InjectionMiscTestApp/InjectionMiscBean/ClientBean"/>
  </session>

This should be supported without the binding, since the beanName of the @EJB annotation references a bean in the same application.

@tkburroughs tkburroughs added bug This bug is not present in a released version of Open Liberty in:EJB Container team:Blizzard labels Jan 15, 2020
@tkburroughs tkburroughs self-assigned this Jan 15, 2020
tkburroughs added a commit to tkburroughs/open-liberty that referenced this issue Jan 15, 2020
Relax the checking in EJBProcessor to allow ejb references
in java:global to use auto-link when the application name
is known and ejb-link has been specified (i.e. ejb-link or beanName).

This will allow EJB references in java:global to auto-link to
an EJB specified by ejb-link that exists in the same application.

If the EJB is in a different application, a binding will still be
required.

Also removed a binding from a test that was previously added to
demonstrate the current behavior. The test will now properly link
to the EJB without the need for a binding.
tkburroughs added a commit that referenced this issue Jan 17, 2020
Issue #10453: Auto-link EJB ref in java global with ejb-link
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This bug is not present in a released version of Open Liberty in:EJB Container team:Blizzard
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant