Hello all, I need to publish the EJB Home interface to the LDAP instead of Websphere application server's default naming service. Is this possible in websphere? If yes where to do this settings ? Thanks a lot, Samir
No, it's not possible. We only support storing Home references in our CosNaming server (the standard JNDI context). Kyle ------------------ Kyle Brown, Author of Enterprise Java (tm) Programming with IBM Websphere See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Ok! thanks. Then I have a problem at hands. Basically my requirement was that we are going to have separate version of set of beans which will have the same jndi names in both the version . How can this be achieved using only one node of websphere? Is there a facility of running two naming service running at different port?
Well we have a concept of releases in the system. We customize the code for a specific special requirement and label this change in separate release. There are instances we work on more than one release. So in each release there can be some change in internal functionality of the beans. But the bean name and the architecture of whole system is the same. And hence we keep the jndi name the same. So there is need to launch more than one release. And in a ideal way we don't want separate machines for each release. In PowerTier EJB server(from Persistance) there is a facility to do exactly this as it allows naming service to be configured to LDAP. So I was checking whether the same facility is available in websphere 4.0.
I thought you were going to say that It's EASY to fix. You have to take advantage of one of the features of J2EE, though. Here's the way to do it. ALWAYS use the "ejbReference" feature of the XML deployment descriptor to look up EJB's. That is, declare EJB references for all of your EJB's in the DD's and make sure that all of your client code (and all of your EJB code too) only uses those references when it does the initialContext.lookup(). Then when you deploy the different releases of your EJB JAR files (and likewise your WAR files and client JAR files -- same difference) you map them to different names for each version. This way the code never changes -- you only have to make sure that you give the EJB's different base JNDI names when you deploy each version of your EJB JAR files and then also update the references to map to the correct base JNDI names. So, if (for instance) you have a WAR file with servlets and JSP's that refer to three EJB's (A, B and C), and a single JAR file that contains all three EJB's, you would deploy the EAR containing the WAR and the JAR three times like so: WAR File EJB JAR Files (Base JNDI Names) Refs DEV TEST PRODUCTION ejb/A A-DEV A-TEST A-PROD ejb/B B-DEV B-TEST B-PROD ejb/C C-DEV C-TEST C-PROD So, as you see, it's not hard at all. BTW, I'm guessing you'd have to change the "ContextRoot" of your WAR files too if you're going to run them all on the same server... Kyle ------------------ Kyle Brown, Author of Enterprise Java (tm) Programming with IBM Websphere See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
One more thing -- I'm curious as to how PowerTier solves this problem by mapping to LDAP -- actually our OS/390 product DOES use LDAP as the naming repository, and we're considering allowing a mapping to LDAP in a future release of WAS (it's been a requested feature before) but it would have the very same problem... Kyle ------------------ Kyle Brown, Author of Enterprise Java (tm) Programming with IBM Websphere See my homepage at http://members.aol.com/kgb1001001 for other WebSphere information.
Hi Kyle, EJBReference idea is great. We are having around 1000 entity beans we would have to develop a tool to generate the code and will manage to put EJBReference in deployment descriptor. About your question on how PowerTier manages LDAP is: In PowerTier5.12 there is a deployment file(.ptc) in which one has a support to configure different naming service, so here we give all the naming service properties(like factory,provider url etc). I have to say that this deployment file is not according to EJB specs. Now when you publish the beans you can give a name of the server running. While publishing PowerTier takes help of ptc also. Now in LDAP PowerTier has a Finder Object for each running application server. This Finder Object is PowerTier specific and not according to EJB specs. The name of the finder Object is as follows: Suppose we give a name to server as Release1 then PowerTier will have a finder object with the name Finder,PowerTierRelease1. So client first looks up on Finder in LDAP and than on Finder object we call a method getHome which will return the actual EJBHome. So total archictecture is not 100% EJB compliant but thats the this works.
Hi Kyle, This dicussion is geting a long one :-). But last question about EJBReferences. Well first I have brush up my knowledge on EJBReferences. But according to the approach you have suggested we have to also change a jndi name at the deployment time. We are having 1000+ so changing jndi base name through UI would be highly impossible. So what I was thinking is ,can we do with only changing the jndi name in some xml when we are going to generate the code instead of using EJBreference? The drawback of this is that we have to find a release name at the time of code generation and have to set the jndi name accordingly. Ideally I would like the release name(i.e. jndi base name) to be set at publishing time but definately at one place not in all beans. Thanks a lot, Samir