At 04:47 PM 7/26/2001 +0100, Vincent Massol wrote:
>Hi Phil,
>
>I don't understand the issue ... If you put your lookup call to the EJB home
>method in your testXXX() method, it will be executed on the server side (not
>that it matters as far as I know - you would also be able to put it in
>beginXXX() if you wanted - or am I missing someething?). What is the JNDI
>ref. problem that you mention ? You'll just need to get an InitialContext
>from you app .server and then do a lookup from the JNDI service of your app
>server ... If you're doing it on the client side (i.e. in beginXXX()) you'll
>just have to make sure you have your app server client jars on your client
>classpath.
>
>It seems there is something obvious that I must be missing ?
Yes. The initial context is created by a managed container (EJB, servlet,
or application client) and populated with the data defined in the
deployment descriptor appropriate to the context. In this case, the context
would be the servlet, and is established when the servlet is invoked by the
servlet engine. There are two potential problems here:
1. If you try to invoke JNDI from beginXXX, you will not have the mappings,
and the available names for the beans will be server-dependant if they are
available at all (this is not defined by the EJB spec).
2. If you invoke it from textXXX, you will have the context of the
redirectory servlet, not the servlet being tested. In either case, you
will not be able to get the desired beans, nor will you be able to test a
servlet which looks for them.