• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get Remote and Home classes imports in Client Code

 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

Appreciate your help.

I am looking for a clarification on EJB lookup in client code. Lets say i would like to use a EJB Service/EJB bean service which developed by third party which is running in a remote machine. Lets say i am consumer of that service and i would like to write client code like below:

[color=blue][/color]

To reference/cast/import these Home and Remote i should have these classes in my build path or classpath. How to get these classes from Service Provider, will they give these classes when we request them and then do we need to put that jar in classpath? Or do we need to run any commands/tools to get stub code?

How that goes? Could you please explain me?


Thanks you very much.
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello experts could you please clarify my doubt?
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi JavaRanch experts,

Could you please clarify my doubt, its important for me.


Appreciate your reply.
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
murali kankanala wrote:

To reference/cast/import these Home and Remote i should have these classes in my build path or classpath. How to get these classes from Service Provider, will they give these classes when we request them and then do we need to put that jar in classpath? Or do we need to run any commands/tools to get stub code?



Okay, here's a brief answer (have to be logout any moment now)!

Your client application (the code that uses the EJBs) is expected to have the application specific home/localhome/remote/local business interfaces in the client classpath.
Some of the application servers generate compile time proxies/stubs (which is not the same as your application specific interfaces). I don't know if there are servers which do that these days. If you are using such a server, you will need those in your client classpath too. But most application servers (JBoss for example) do dynamic proxy/stub generation so you won't need those stubs in your client classpath.
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You said most of the server(JBoss) does dynamic stub generation, what is that mean? when i write code like ctx.lookup("MyEJB"), what about right side reference variable( I should have the code like MyHome home = ctx.lookup("MyEJB") ). So should i get atleast some jar which contains this MyHome interface and MyRemote interface right?
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i dont have some code like MyHome home = ...... my client code can not be compiled, so when the this dynamic stub generation comes into picture?
 
Ram Narayan.M
Ranch Hand
Posts: 247
Chrome Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If servlet is the client to the EJB and "war" files and "jar" files [containing bean program and Deployment Descriptors] are packaged as "ear" file, then, no need of any remote interfaces or local interfaces in "war" files, since both entities are in same package...

If the client out of container accessing the EJB, then jar files containing remote, home interfaces ".class" files should be furnished...

Dynamically stub will be generated and serialized to the Client side... But to refer to the Stub, the client will be using reference type of Home, remote interfaces... For that jar files has to be provided by the ServiceProvider...
 
murali kankanala
Ranch Hand
Posts: 110
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you very much Ram. So a service provider should give some jar file which has these EJB Home and Remote interface .class files. I got you know.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!