14.3.1 Using a bindings file
If generating default bindings during deployment, default names suitable for most applications are used. However, these defaults do not work if:
- You want to explicitly control the global JNDI names of one or more EJB files.
- We need tighter control of data source bindings for container-managed persistence (CMP) beans. That is, you have multiple data sources and need more than one global data source.
- You must map resource references to global resource JNDI names that are different from the java:comp/env name. In such cases, use a specific bindings file to customize the bindings created.
To use a bindings file when installing an application, load it by clicking Browse next to the Specific bindings file option. When using this file, only specify bindings that differ from the defaults, not the full bindings.
Example 14-6 is an example showing a bindings file used to change the JNDI name of an EJB.
Example 14-6 Using a bindings file to change the JNDI of an EJB
<?xml version="1.0"?> <!DOCTYPE dfltbndngs SYSTEM "dfltbndngs.dtd"> <dfltbndngs> <module-bindings> <ejb-jar-binding> <jar-name>helloEjb.jar</jar-name> <!-- this name must match the module name in the .ear file --> <ejb-bindings> <ejb-binding> <ejb-name>HelloEjb</ejb-name> <!-- this must match the <ejb-name> entry in the EJB jar DD --> <jndi-name>com/acme/ejb/HelloHome</jndi-name> </ejb-binding> </ejb-bindings> </ejb-jar-binding> </module-bindings> </dfltbndngs>