java:comp/env/-- is private to each ejb and is defined by the ejb-ref and ejb-local-ref in the bean, what you should do instead is :
in your ejb-jar.xml for the bean that references CompanyUser bean through java:comp/env/ejb/CompanyUser <session> ... <ejb-local-ref> <ejb-ref-name>ejb/CompanyUser</ejb-ref-name> ... plus information according to the bean : ejb-ref-type, local-home, local ... <ejb-link>CompanyUser<ejb-link> </ejb-local-ref> ... </session> of course we assume that you two beans are in the same jar deployement. otherwise you don't specifu ejb-link and use jboss.xml instead to make the link to the bean. --- Derek Lin <[EMAIL PROTECTED]> a écrit : > Rick, > > The short name will work ok. (Because it is the > JNDI name). But having the short name working is > definitely more convenient. > > I might have found out what the problem is. I think > it's my misunderstanding of ejb-ref. I read some > more on it. If I am not wrong, ejb-ref is used to > refer to OTHER ejb's. > > So I have it in my company bean: > > * @ejb:ejb-ref ejb-name="CompanyUser" > view-type="local" > * @ejb:ejb-ref ejb-name="CompanyUser" > view-type="remote" > > > After that, this line of code works: > > CompanyUserLocalHome home = > CompanyUserUtil.getLocalHome(); > > However, I am not 100% sure when CompanyUserUtil now > can access the long name > (java:comp/env/ejb/CompanyUserLocal), I mean, then > ejb-ref entry is done in my Company bean (in the > ejb-jar.xml), not the CompanyUserUtil (there is no > entry for CompanyUserUtil in the ejb-jar.xml). Any > thoughts? > > -- Derek > > ----- Original Message ----- > From: Rick LaBanca > To: [EMAIL PROTECTED] > Sent: Saturday, October 26, 2002 8:02 PM > Subject: Re: [JBoss-user] lookup java:comp/env/ > > > I had this same issue. I Think it may be correct > that the ejb doesn't have access to this absolute > path you are trying, but not positive. > > Anyway, the utility class generated by xdoclet > makes two string constants, one of them is the short > name you used succesfully. > > My xdoclet was using the longer name too, but I > changed something in my class or specs and it > started making a util class that used the shorter > name. I don't have the code in front of me (not at > work now), and I really didn't know then what > exactly fixed it. Hope that's a clue. > > I find the namespace issues to be confusing to > begin with (for most people, the roles of a separate > person being an app assembler and deployer are > mythical!) > > rick > > > > From: Derek Lin > To: [EMAIL PROTECTED] > Sent: Saturday, October 26, 2002 9:20 PM > Subject: [JBoss-user] lookup java:comp/env/ > > > I have found that > initialContext.lookup("java:comp/env/ejb/CompanyUserLocal") > won't work with JBoss. Instead, I have to use > initialContext.lookup("CompanyUserLocal"). > > In my jboss.xml, there is this entry: > > <entity> > <ejb-name>CompanyUser</ejb-name> > <jndi-name>ejb/CompanyUser</jndi-name> > > <local-jndi-name>CompanyUserLocal</local-jndi-name> > </entity> > > I can see how > initialContext.lookup("CompanyUserLocal") is > working, but can't see why > initialContext.lookup("java:comp/env/ejb/CompanyUserLocal") > will not work other than the fact the JBoss is not > supporting it. It is supposed to be a standard. > More importantly, it is the way Xdoclet generates > its util classes. > > Any thoughts? > > -- Derek > ___________________________________________________________ Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français ! Yahoo! Mail : http://fr.mail.yahoo.com ------------------------------------------------------- This SF.net email is sponsored by: ApacheCon, November 18-21 in Las Vegas (supported by COMDEX), the only Apache event to be fully supported by the ASF. http://www.apachecon.com _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user