The wrapper class is probably running in client space, not server space (at
least thats how my wrapper classes work).  If you are in Tomcat/2.1, comp/env
might work.  For any other client, though, you would need to look up by jndi
name on the client since comp/env will not be bound.

Only work around would be to get wrapper to run on the server somehow (ie. call
it from another bean instead of client).  Otherwise no comp/env for wrapper!

Jim Archer wrote:

> Hi All...
>
> I spent some time fighting something involving name service and I
> seriousely don't know if its a bug or a feature.
>
> I created a stateless session bean to provide a serice. I then wrote a
> class to wrap that SLSB with a has-a relationship. When the wrapper class
> is instansiated the code that instansiated it sets some properties and then
> calls its execute method. The execute method would lookup the SLSB useing
> the java:comp/env namespace and make it do its thing.
>
> This seemed like a good design and I did adjust the ejb-jar.xml file and
> jboss-web.xml file to accomadate it. Unfortunatly, the lookup always
> resulted with a NamingEsception being thrown that said ejb/Thingy not bound.
>
> If I then took the lookup code out of the wrapper class and put it directly
> into the code that instansiates the wrapper class, the lookup worked fine.
> In fact, to solve this I ended up looking up the SLSBs home interface and
> then passing that into the wrapper class, which did all the rest
> successfully. So the user code would get the home interface, instansiate
> the wrapper object, and hand the home interface object to the wrapper
> object, which would then create the SLSB and call its methods.
>
> This happened whether the user code was in a servlet, a stateless session
> bean or an entity bean. I was really hopeing to encapsulate the lookup
> code, but it just dossen't work.
>
> This is all running on jBoss-2.1-tomcat-beta with JDK 1.3 on W2K. In all
> cases, jndiview showd the SLSB as bound.
>
> So I wonder, is this a bug or is this behavior correct? If it is correct,
> how can I make this work?
>
> Thanks!
>
> Jim
>
> ********************************************
> I shall be telling this with a sigh
> Somewhere ages and ages hence:
> Two roads diverged in a wood, and I -
> I took the one less traveled by,
> And that has made all the difference.
>
> - Robert Frost, 1916
>
> --
> --------------------------------------------------------------
> To subscribe:        [EMAIL PROTECTED]
> To unsubscribe:      [EMAIL PROTECTED]



--
--------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]

Reply via email to