Hia guys,


Here is a bit of my experience with this stuff - I found out that if I
have a regular Java client it's the ejb-jar.xml's <ejb-name> that is
being used to lookup the bean name without the comp/env. The comp/env is
only to be used by J2ee clients i.e. servlets or JSPs. For the J2EE
clients, it is the <ejb-ref> name that is used in the lookup.

It's weird as all hell !! But that how  I found out about this. IN other
words whatever you are using for the Home's lookup will depend on the
type of client you are using. To recap - for Java clients use
lookup("beanName") for J2EE clients ("java:comp/env/beanName")

Try giving this a try !!!!

Good Luck



        -----Original Message-----
        From:   Magnus Rydin [SMTP:[EMAIL PROTECTED]]
        Sent:   Friday, March 16, 2001 4:30 AM
        To:     Orion-Interest
        Subject:        SV: Problems with JNDI lookups of <ejb-ref-name>
defined in application-client.xml  from a client application...

        Did you try looking up "java:comp/env/ejb/id" ? 
        WR 

        > -----Ursprungligt meddelande----- 
        > Från: Alex Paransky [
mailto:[EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> ] 
        > Skickat: den 15 mars 2001 14:11 
        > Till: Orion-Interest 
        > Ämne: Problems with JNDI lookups of <ejb-ref-name> defined in 
        > application-client.xml from a client application... 
        > 
        > 
        > I have a client application which has META-INF with the
following 
        > application-client.xml definition: 
        > 
        > <application-client> 
        >   <ejb-ref> 
        >     <ejb-ref-name>ejb/id</ejb-ref-name> 
        >     <ejb-ref-type>Session</ejb-ref-type> 
        >     <home>com.indnet.model.id.IdSessionHome</home> 
        >     <remote>com.indnet.model.id.IdSession</remote> 
        >     <ejb-link>Id</ejb-link> 
        >   </ejb-ref> 
        > </application-client> 
        > 
        > In the client, I attempt to do the following: 
        > 
        > new InitialContext().lookup("ejb/id"); 
        > 
        > The above fails with the naming exception, telling me that 
        > ejb/id cannot be 
        > found: 
        > 
        > Exception in thread "main" 
        > javax.naming.NameNotFoundException: ejb/id not 
        > found 
        >         at com.evermind.server.rmi.RMIContext.lookup(JAX) 
        >         at com.evermind.naming.jz.lookup(JAX) 
        >         at
javax.naming.InitialContext.lookup(InitialContext.java:350) 
        >         at
com.indnet.model.id.test.Client.main(Client.java:16) 
        > 
        > If I change my client line to read: 
        > 
        > new InitialContext().lookup("Id"); 
        > 
        > Things work correctly.  "Id" is the <ejb-name> used for my
object: 
        > 
        > <enterprise-beans> 
        >     <session> 
        >       <ejb-name>Id</ejb-name> 
        >       <home>com.indnet.model.id.IdSessionHome</home> 
        >       <remote>com.indnet.model.id.IdSession</remote> 
        >       <ejb-class>com.indnet.model.id.IdSessionBean</ejb-class>

        >       <session-type>Stateless</session-type> 
        >       ... 
        > 
        > What is the purpose of application-client.xml if I cannot 
        > create references 
        > and use the name specified in <ejb-ref-name> to lookup the 
        > components?  Or 
        > am I missing something? 
        > 
        > Thanks. 
        > -AP_ 
        > 
        > 
        > 
        

Reply via email to