The <ejb-link> should contain the <ejb-name> of the bean you want
to reference. Not the jndi name.

Regards,
Adrian

On Fri, 2003-09-26 at 15:21, Bruce Ashton wrote:
> I'm having some difficulty working out the intricacies of JNDI and
> ejb-local-ref elements in ejb-jar.xml
> 
> I have a simple entity bean with a local interface that can be found with a
> lookup on "local/TemplateEntity", i.e.
> 
>             lCtx = new InitialContext();
>             TemplateEntityHome teHome =
>                 (TemplateEntityHome)lCtx.lookup("local/TemplateEntity");
>             TemplateEntity templateEntity = teHome.create();
> 
> This works.
> 
> I have a Session Bean with an ejb-jar.xml descriptor file,
> 
> <ejb-jar>
>     <enterprise-beans>
>         <session>
>             <ejb-name>ejb/TemplateSession</ejb-name>
> 
>  
> <ejb-class>com.activis.ejb.session.TemplateSessionBean</ejb-class>
>             <home>com.activis.ejb.session.TemplateSessionHome</home>
>             <remote>com.activis.ejb.session.TemplateSession</remote>
> 
>             <session-type>Stateless</session-type>
>             <transaction-type>Container</transaction-type>
>         </session>
>     </enterprise-beans>
> </ejb-jar>
> 
> (I have removed description and display-name elements for succinctness.)
> 
> I want to add an ejb-local-ref element in something like the following
> manner;
> 
> <ejb-jar>
>     <enterprise-beans>
>         <session>
>             <ejb-name>ejb/TemplateSession</ejb-name>
> 
>  
> <ejb-class>com.activis.ejb.session.TemplateSessionBean</ejb-class>
>             <home>com.activis.ejb.session.TemplateSessionHome</home>
>             <remote>com.activis.ejb.session.TemplateSession</remote>
> 
>             <session-type>Stateless</session-type>
>             <transaction-type>Container</transaction-type>
>             <ejb-local-ref>
>               <ejb-ref-name>TemplateEntityX</ejb-ref-name>
>               <ejb-ref-type>Entity</ejb-ref-type>
>  
> <local-home>com.activis.ejb.entity.TemplateEntityHome</local-home>
>               <local>com.activis.ejb.entity.TemplateEntity</local>
>               <ejb-link>local/TemplateEntity</ejb-link>
>             </ejb-local-ref>
>         </session>
>     </enterprise-beans>
> </ejb-jar>
> 
> or possibly,
> 
>             <ejb-local-ref>
>               <ejb-ref-name>TemplateEntityX</ejb-ref-name>
>               <ejb-ref-type>Entity</ejb-ref-type>
>  
> <local-home>com.activis.ejb.entity.TemplateEntityHome</local-home>
>               <local>com.activis.ejb.entity.TemplateEntity</local>
>               <ejb-link>TemplateEntity</ejb-link>
>             </ejb-local-ref>
> 
> I would have thought I should now be able to lookup the TemplateEntity bean
> from TemplateSessionBean with something like;
> 
>             lCtx = new InitialContext();
>             TemplateEntityHome teHome =
>                 (TemplateEntityHome)lCtx.lookup("local/TemplateEntityX");
>             TemplateEntity templateEntity = teHome.create();
> 
> or
> 
>             lCtx = new InitialContext();
>             TemplateEntityHome teHome =
>                 (TemplateEntityHome)lCtx.lookup("TemplateEntityX");
>             TemplateEntity templateEntity = teHome.create();
> 
> or
> 
>             lCtx = new InitialContext();
>             TemplateEntityHome teHome =
>                 (TemplateEntityHome)lCtx.lookup("ejb/TemplateEntityX");
>             TemplateEntity templateEntity = teHome.create();
> 
> But nothing seems to work.  What am I doing wrong?  The jboss.xml file for
> TemplateEntity is just,
> 
> <jboss>
>    <enterprise-beans>
>       <entity>
>          <ejb-name>TemplateEntity</ejb-name>
>          <jndi-name>TemplateEntity</jndi-name>
>       </entity>
>    </enterprise-beans>
> </jboss>
> 
> Thanks,
> Bruce
> 
> 
> Please note that:
>  
> 1. This e-mail may constitute privileged information. If you are not the intended 
> recipient, you have received this confidential email and any attachments transmitted 
> with it in error and you must not disclose, copy, circulate or in any other way use 
> or rely on this information.
> 2. E-mails to and from the company are monitored for operational reasons and in 
> accordance with lawful business practices.
> 3. The contents of this email are those of the individual and do not necessarily 
> represent the views of the company.
> 4. The company does not conclude contracts by email and all negotiations are subject 
> to contract.
> 5. The company accepts no responsibility once an e-mail and any attachments is sent.
> 
> http://www.activis.com
> 
> 
> [Insert Annotation Here]
> 
> This annotation was added by the e-scan service.
> http://www.activis.com
> ----------------------------------------------------------------------------------
> This message has been checked for all known viruses by e:)scan.
> For further information please contact [EMAIL PROTECTED]
> 
> 
> -------------------------------------------------------
> This sf.net email is sponsored by:ThinkGeek
> Welcome to geek heaven.
> http://thinkgeek.com/sf
> _______________________________________________
> JBoss-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/jboss-user
-- 
xxxxxxxxxxxxxxxxxxxxxxxx 
Adrian Brock
Director of Support
Back Office
JBoss Group, LLC 
xxxxxxxxxxxxxxxxxxxxxxxx 



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
JBoss-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to