How to communicate between two EJ beans? Should i use JNDI?
Yes, you have to use JNDI. JNDI look up is a must for a bean to access from any client, though it is another bean
Remember that if your client is in the same
JVM as the bean, you can get the JNDI InitialContext
without any arguments. WLS 5.1 anyway.
InitialContext ic = new InitialContext();
Remember that if your client is in the same JVM as the bean, you can get the JNDI InitialContext without any arguments. WLS 5.1 anyway.
This should be the case even if your client is NOT in the same VM as the server. This is possible, in the case of a Servlet/JSP, with the help of the web app container. In the case of a normal Java client, there should be some sort of Application Client Container. Look at the J2EE specs for details. Moreover, having this feature is just a matter of putting a properly configured jndi.properties file in the CLASSPATH, and I can't understand why WLS didn't put one in their client jar files and used the JNDI environment everywhere in their example.
Just my 2 eurocents.