If you dont have your client in the same archieve, then you need to do lookup using Initial context and JNDI name.
When you say archive, can you please elaborate? I have 2 situations that I can give, and have tried.
1. 2 SLSBs both in the same EJB jar. The injector bean is able to inject all 3(Remote, Local and No-Interface views) of the injected bean - This has been tried and tested.
2. 2 SLSBs. Each in its own EJB jar. Both jars are packaged in the same EAR. The injector bean, has no ejb-ref present as no ejb-jar.xml has been used(Is there a way
to use ejb-ref using annotations?). The injected bean's remote, local and no-interface views were tried in the injector bean. The EAR is not getting deployed in Weblogic12C.
Below is the stack trace.
Yes you can and I did it.
Well actually in depends on your type of Java client. In both cases the Client is running a JVM different to the running the application server.
If you have Java standalone application running in an ACC (Application Client Container) you can use annotations to inject EJBs coming from the
JNDI in the application server. The reason it works is that the ACC and the Application server are in close communication.
But if your java standalone application is running outside an ACC then it does not work as far as I know. You have to retrieve the remote EJB
by doing a manual JNDI lookup with the Initial Context initialised with the PROVIDER_URL of the relevant application server.
Unfortunately I dont have enough time to find you a step by step guide now, but I hope it is clear enough.
When I get the chance I'll add some more if you want to
Thanks, but I think you have misunderstood the query I have raised here. I am referring to EJB injection within another EJB and NOT to the final client.
More like the context upto which EJBs' different views, can be injected in a given environment with/without an ejb-ref/ejb-link kind of setup.
I am not sure whether I have been able to clarify my query.
If someone could even guide me where to look for answers from within the EJB 3.1 specs. that too would be helpful.