I was trying to look up a ejb component
on a weblogic server in network from my JSP page in another weblogic server
it is able to Look up server resourses like(Datasources)
but not any ejb's
THIS IS NOT WORKING
Hashtable env = new Hashtable();
Context ctx = new InitialContext(env);
Object ref= ctx.lookup("JNDICUSTOMER");
System.out.println("After the look up");
I assume that u r not much familiar with how jndi works.
JNDI stores every name with specific context. For any object u should specify context also, so as not to confuse JNDI in case there are more than 1 occurance of same name.
As per my knowledge, in case of weblogic, the object name without context is mapped to EJB or remote object, by jndi. For accessing any other objects like connection pool, on weblogic atlease, u should use something like
where demo pool is the connection pool to be looked up in JNDI, as an argument to lookup method.
This string is internally converted to context by weblogic & JNDI will give u proper object.
For more details, kindly go thru weblogic's example of bean managed account & ofcourse, documentation. That should help u accessing resources using JNDI.
i dont think you got my problem right,
i asked for a way to contact a component on one server from other app server,
the context what u said is not the solution for that
using the context is not a great thing try for my problem
any way thanx
All EJBs act as normal client, when it comes to invoking method on some other EJB that may be deployed on the same server or different server itself. There is no way for any EJB to find out whether caller of method is another EJB or application or applet ...
Also there is no API for any EJB to invoke another EJB. U have to follow the same route, as other type of clients( applications or applet) would have taken. This is intended, as container can then carry out all the state management related activities more uniformly.
Check that you are using the correct name. Look at the beans weblogic-ejb-jar.xml file and locate the <jndi-name> tag. This is the string to use in the lookup.
e.g. if this is in the XML file
use this in your lookup:
You can use the Weblogic consoles Naming screen to examine the entire contents of the WLS Naming Service.