• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Remote Client - Annotation lookup possible?

 
Ranch Hand
Posts: 49
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is it possible that a remote client can look up a Session bean or for that matter any bean using a annotation based injection?

Referring specifically to a session bean deployed on weblogic 12c and a simple java client running on a different jvm.

I observe in some posts that glassfish requires a client to have an empty initial context(new InitialContext() ) to lookup an
ejb...but how is that even possible if the client doesn't even know where the server jvm(provider_url) resides?
EJB3.1 lookup
Looks like this is a client app running on same jvm as EJB

I some how get the impression that the Remote lookup of EJB using annotation injection is for EJB Lite or for ears deployed
within the same server...

Can someone please guide me to a definitive guide to this effect from within the EJB3.1 specification?
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

If you dont have your client in the same archieve, then you need to do lookup using Initial context and JNDI name.

Regards
Meiyappan
 
Anirudh Gupta
Ranch Hand
Posts: 49
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Meiyappan Kannappa wrote:Hi,

If you dont have your client in the same archieve, then you need to do lookup using Initial context and JNDI name.

Regards
Meiyappan



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.


The Injector Bean,


The injected bean,
 
Ranch Hand
Posts: 180
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Anirudh Gupta
Ranch Hand
Posts: 49
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

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.

Thanks in Advance.
 
Anirudh Gupta
Ranch Hand
Posts: 49
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,


I am sorry, I must add I am trying to achieve annotation based injection here. It is apparent in the code posted in the earlier post.

Thanks.
 
I knew I would regret that burrito. But this tiny ad has never caused regrets:
New web page for Paul's Rocket Mass Heaters movies
https://coderanch.com/t/785239/web-page-Paul-Rocket-Mass
reply
    Bookmark Topic Watch Topic
  • New Topic