Wednesday, September 10, 2014

weblogic integrating remote ejb via foreign jndi provider

Server Env Overview

weblogic 12c (12.1.1), with domain setup as
  • AdminServer - domain admin 
  • CoreServer - host core business service EJBs
  • AppServer - host application specific EJBs which uses core business service EJBs

Foreign JNDI Provider Setup

login to admin console -> domain -> Services -> Foreign JNDI Providers, create new Foreign JNDI Provider

where Provider URL is pointing to CoreServer and Targets points to AppServer.

Add Foreign JNDI Links as

where Local JNDI Name is the global JNDI name used in EJBs from AppServer and Remote JNDI Name is the global JNDI name for remote EJBs deployed in CoreServer.


Inject Remote EJBs via @EJB annotation

To use remote ejbs from JavaEE components from AppServer (say EJBs), simply add EJB ref as

@EJB(mappedName="<the_local_JNDI_name_as_defined_in_Foreign_JNDI_Links>") 
AssignmentEjb tmpEjb;

where mappedName is the global JNDI name as defined in local JNDI name in Foreign JNDI Links in Weblogic Admin console.

1 comment: