Hi Emmanuel,
Thanks for your reply.
I am doing what you just mentioned above but my question is i am not able to do lookups using "java:comp/env" .websphere complains about java not being set. example that you have given
DualEntityLocalHome homeObject = (DualEntityLocalHome)initC
DualEntityLocalHome homeObject = (DualEntityLocalHome)initC
javax.naming.Context env =
ctx.lookup("java:comp/env"
So the question is if websphere by default cannot lookup "java:comp/env" what setting does the server require or in other words how do i configure it.
I hope you will be able to shed light on this issue.
Cheers
Amit Sood
Main Topics
Browse All Topics





by: ECollinPosted on 2006-12-01 at 04:51:15ID: 18053159
hi,
/env-entry -name> String</en v-entry-ty pe>
t(); );
tyRemoteHo me</ejb-re f-name> ref-type> emoteHome< /home> yRemote</r emote> jar#DualEn tity</ejb- link> tyLocalHom e</ejb-ref -name> ref-type> ntityLocal Home</loca l-home> Local</loc al> jar#DualEn tity</ejb- link>
tx.lookup( "java:comp /env/ejb/D ualEntityL ocalHome") ; Ctx.lookup ("java:com p/env/ejb/ DualEntity RemoteHome ");
Do you make these lookups from inside your web application ?
If you want to create environment entries in your web application and acces to them from your java code :
déclaration for your variable in the web.xml file :
<env-entry>
<description>welcome message</description>
<env-entry-name>greetings<
<env-entry-type>java.lang.
<env-entry-value>Welcome to the Inventory Control System</env-entry-value>
</env-entry>
java code :
javax.naming.Context ctx =
new javax.naming.InitialContex
javax.naming.Context env =
ctx.lookup("java:comp/env"
// obtain the greetings message
//configured by the deployer
String str = (String) env.lookup("greetings");
2. If you want to obtain a reference to your ejb via an "indirection" use this :
in the web.xml :
<ejb-ref id="EjbRef_02">
<ejb-ref-name>ejb/DualEnti
<ejb-ref-type>Entity</ejb-
<home>dual.ejb.DualEntityR
<remote>dual.ejb.DualEntit
<ejb-link>DualEJBModule01.
</ejb-ref>
<ejb-local-ref id="EJBLocalRef_02">
<ejb-ref-name>ejb/DualEnti
<ejb-ref-type>Entity</ejb-
<local-home>dual.ejb.DualE
<local>dual.ejb.DualEntity
<ejb-link>DualEJBModule01.
</ejb-local-ref>
the lookup :
DualEntityLocalHome homeObject = (DualEntityLocalHome)initC
or
DualEntityRemoteHome homeObject = (DualEntityRemoteHome)init
Emmanuel