jaggernat
asked on
jndi basics
hi experts
have this question
In ejbs, the client program (which is trying to access an ejb) has the jndi lookup which goes like this
InitialContext ic = new InitialContext()
Object obj = ic.lookup("blabla");
StudentHome home =(StudentHome) PortableRemoteObject.narro w(blabla,S tudentHome .class);
StudentRemote remote= home.create();
my question is ,
I know jndi is used to look up different resources, but what exactly does jndi look up in the above statement.
i want to know how exactly jndi ( in above program) communicates with the component deployed in the server.
thanks
J
have this question
In ejbs, the client program (which is trying to access an ejb) has the jndi lookup which goes like this
InitialContext ic = new InitialContext()
Object obj = ic.lookup("blabla");
StudentHome home =(StudentHome) PortableRemoteObject.narro
StudentRemote remote= home.create();
my question is ,
I know jndi is used to look up different resources, but what exactly does jndi look up in the above statement.
i want to know how exactly jndi ( in above program) communicates with the component deployed in the server.
thanks
J
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thats a huge tutorial . ok , how is jndi related to homeinterface or remote interface that we create in the ejb component .
thanks,
J
thanks,
J
jndi is the lookup mechanism used to locate the required objects
http://java.sun.com/products/jndi/tutorial/getStarted/examples/naming.html
http://java.sun.com/products/jndi/tutorial/getStarted/examples/naming.html
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
so ejb/com/package/HelloHome is the jndi name of ejb class. right
> Object obj = prop.lookup("ejb/com/packa ge/HelloHo me");
that should be the following shouldn't it?
Object obj = prop.lookup("java:comp/ejb /com/packa ge/HelloHo me");
if you are more intested in EJB as opposed to JNDI then theres an example here:
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rnam_example_prop3.html
that should be the following shouldn't it?
Object obj = prop.lookup("java:comp/ejb
if you are more intested in EJB as opposed to JNDI then theres an example here:
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.websphere.nd.doc/info/ae/ae/rnam_example_prop3.html
>> that should be the following shouldn't it?
It could be anything, depending upon the server. For example, in Websphere, you could perform look-up on "WFInd.MaintenanceService" where WFInd.MaintenanceService is defined in ibm-ejb-jar-bnd.xmi as:
<ejbBindings xmi:id="MaintenanceService _Bnd" jndiName="WFInd.Maintenanc eService">
<enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml #Maintenan ceService" />
</ejbBindings>
This would search for <ejb-name>MaintenanceServi ce</ejb-na me> in ejb-jar.xml.
It could be anything, depending upon the server. For example, in Websphere, you could perform look-up on "WFInd.MaintenanceService"
<ejbBindings xmi:id="MaintenanceService
<enterpriseBean xmi:type="ejb:Session" href="META-INF/ejb-jar.xml
</ejbBindings>
This would search for <ejb-name>MaintenanceServi
> so ejb/com/package/HelloHome is the jndi name of ejb class. right
Yes thats correct =)
Yes thats correct =)
ASKER
thanks for prompt response,
J