Hi Michael,
I am not sure if this is what you are asking for:
In my servlet client:
try{
InitialContext ctx=new InitialContext();
Iteamdetails
iteamdetails=(Iteamdetails)ctx.lookup("IteamdetailsBeanJNDI");
iteamdetailhlp=iteamdetails.BargainCornItems(barconr);
..................
...................
}catch(Exception ex){
System.err.println("Can not access DB");
}
Iteamdetails is the romote interface.
inside my implementation class, I have set up the JNDI as below:
@Stateful(name="itemdetails", mappedName="IteamdetailsBeanJNDI")
to which the above servlet client makes a call to as:
Iteamdetails iteamdetails=(Iteamdetails)ctx.lookup("IteamdetailsBeanJNDI");
Does this help??
eve
>From: Michael Munn <Michael.Munn_at_Sun.COM>
>Reply-To: ejb_at_glassfish.dev.java.net
>To: ejb_at_glassfish.dev.java.net
>Subject: [Fwd: EJB 3.0 Lookup]
>Date: Thu, 31 May 2007 13:28:23 -0700
>
>
>From: Michael Munn <Michael.Munn_at_Sun.COM>
>To: ias_at_sun.com
>Subject: EJB 3.0 Lookup
>Date: Thu, 31 May 2007 13:07:51 -0700
>Hi All,
>
>In EJB 3.0 to call another session bean on a remote server I use injection:
>
>@EJB(mappedName="corbaname:iiop:192.168.0.2:3700#EJB2") EJB2Remote
>ejb2Remote;
>
>If I wanted to make a call to the session bean on the same server
>dynamically how would I do it in EJB 3.0
>
>Should this work?
>
>InitialContext ctx = new InitialContext();
>EJB2Remote ejb2Remote =
>(EJB2Remote)ctx.lookup("corbaname:iiop:192.168.0.2:3700#EJB2");
>
>Using the injection works fine, but I get the following error with the
>second approach:
>
>"javax.naming.NameNotFoundException [Root exception is
>org.omg.CosNaming.NamingContextPackage.NotFound:
>IDL:omg.org/CosNaming/NamingContext/NotFound:1.0]"
>
>What is the correct syntax for explicitly doing a lookup in EJB 3.0?
>
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: ejb-unsubscribe_at_glassfish.dev.java.net
>For additional commands, e-mail: ejb-help_at_glassfish.dev.java.net
_________________________________________________________________
Could you be the guest MSN Movies presenter? Click Here to Audition
http://www.lightscameraaudition.co.uk