Appendix A. JNDI namespaces
This chapter covers:
-
This appendix covers
-
- Understanding the Enterprise Naming Context
- Examining common JNDI namespaces
As we discussed in chapter 7, EJBs are automatically bound into a JNDI server when they’re deployed to the application server. The JBoss JNDI naming server is called JBossNS. Every application server binds beans into naming contexts of the application server’s own choice. For example, as you saw in chapter 7, if you deploy an EAR file, JBoss will bind the beans into a context relative to the EAR file name. JBoss uses this convention, but other application servers may or may not use different strategies. In this appendix, we’ll explore how JBoss does JNDI binding and how to generically bind your applications in JNDI, making them more portable across application servers.
Some problems arise when you write code that references EJBs bound to the JNDI context that a particular vendor chooses. First, if you decide to migrate an application from one application server to another, your code has to be modified. For example, if you’re running on WebLogic and decide to migrate to JBoss, you have to update all your JNDI references in your code to use the JBoss convention rather than the WebLogic convention. This task might not be bad, but some people have JNDI references hardcoded throughout their code, making it a little more difficult.