7

In the Administration COnsole of WAS 7, on the Applications > Application Types > WebSphere enterprise applications > application > EJB JNDI names section, I have a table with four columns :

  • EJB Module (e.g. ProjectEJB.jar)
  • EJB (e.g. BeanBO )
  • URI (e.g. ProjectEJB.jar, META-INF/ejb-jar.xml
  • Target resource JNDI Name (with empty fields)

Something like this :

enter image description here

What's the jndi name of my LogWriter bean ?

Daniel Flores
  • 770
  • 3
  • 12
  • 31

3 Answers3

8

Below you have table with default names. Each bean gets short and long form. You can override default using ibm-ejb-jar-bnd.xml file or during installation via console. During module startup bindings will be visible in SysyemOut.log

You can read about default bindings here: http://pic.dhe.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.iseries.doc/info/iseriesexp/ae/cejb_bindingsejbfp.html

Description                              Binding pattern
Short form local interfaces and homes    ejblocal:<package.qualified.interface>
Short form remote interfaces and homes   <package.qualified.interface>
Long form local interfaces and homes     ejblocal:<component-id>#<package.qualified.interface>
Long form remote interfaces and homes    ejb/<component-id>#<package.qualified.interface>

The component-id defaults to <application-name>/<module-jar-name>/<ejb-name>
Gas
  • 17,601
  • 4
  • 46
  • 93
  • So if jndi configured in ejb-jar.xml, will it override the EJB JNDI lookup configured in WebSphere admin console? – Govinda Sakhare Sep 10 '19 at 12:36
  • 1
    @GovindaSakhare - no, the JNDI configuration in the console always takes a precedence from any descriptors to allow you for manual override after deployment. – Gas Sep 10 '19 at 13:36
4

One can set it by adding a file META-INF/ibm-ejb-jar-bnd.xml - something like this:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar-bnd xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://websphere.ibm.com/xml/ns/javaee" xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-ejb-jar-bnd_1_0.xsd" version="1.0">
    <session name="LogWriter" simple-binding-name="my/ejb/LogWriterService"/>
</ejb-jar-bnd>

We used to have a script to generate these server-specific files for the different vendors.

Ed Randall
  • 6,887
  • 2
  • 50
  • 45
  • Thanks Ed !, as you said, this is for a custom JDNI. I have tried to change it in the Administration Console but there wasn't and 'Ok' or 'Save' button, but with the ibm-ejb-jar-bnd.xml file it works, thanks. – Daniel Flores May 30 '14 at 22:56
0

Thanks to [https://stackoverflow.com/a/16936264/539783][2]

For local lookup :

String jndi = "ejblocal:enterprise_app_name/ejb_web_project_name.jar/ejb_name#name.of.local.impl.interface";

For remote lookup :

String jndi = "ejb/enterprise_app_name/ejb_web_project_name.jar/ejb_name#name.of.remote.impl.interface";

Example :

ejblocal:ServicesEAR/LogWriter.jar/LogWriter#ILogWriter

UPDATE : It doesn't work in some cases.

Community
  • 1
  • 1
Daniel Flores
  • 770
  • 3
  • 12
  • 31