Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

A basic doubt in EJB

 
paramesh ande
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
How can we develop the client applications providing the location transperency? Whenever we are writing application for a web client then we need to put the ejb component in the class path of the web application.Does it not breach of locational transperency?
Thanks in advance
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 35975
422
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you make a remote EJB call, you just need to have the stubs in the classpath, not the implementation. The actual implementation could be on multiple servers. As the client, you don't need to know which ones. Hence locational transparency.
 
Valentin Tanase
Ranch Hand
Posts: 704
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Paramesh,

First of all the term location transparency has a different meaning. Using a famous Microsoft slogan �the network is the computer� might give you an idea about what location transparency is. Basically the contract is that in a distributed environment developers can access resources everywhere on the network in a similar way they access local resources. From the developer perspective there is no difference (in theory; in practice we kind of figured out that there is). This is also not an EJB specific feature and is an aim of all distributed environments, including RMI, DCOM, CORBA, etc.
What you�re actually pointed out is just usual compiling and linking process and is absolutely the same whether you�re using distributed technologies or not, or even whether you�re using Java or not. If you need to use a class, interface or other symbols the compiler/linker needs to have a way of reaching it. It�s the same in C or C++ and Java is no exception of course.
Regards.
 
paramesh ande
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank u very much Jeanne and valentine ,for ur replies.
Now I got the clear idea,that EJB component that is deployed in the application server sholud be maintained in the class path of the clent programm.But the required runtime environment and the middle tier services will be provided by the app server only.
As Jeanne said how can we get only stubs to place in the class path instead of the whole ejb component

thanks®ards
paramesh
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you make a remote EJB call, you just need to have the stubs in the classpath, not the implementation.

Let's say that you write a home interface named GetHome, and that the container creates these implementations:
- GetHomeImpl (the class of the remote home object)
- GetHomeImpl_stub (the class of the home object stub)

The client will need GetHome and GetHomeImpl_stub on its classpath. GetHome is needed as the stub instance may be narrowed and must be cast to this home interface, GetHomeImpl_stub is needed as this is the class of the stub. Both will be loaded by the class loader. So, just to be clear, it's the stub class rather than the stub instance which is needed on the classpath.

Similarly, the component interface and its client implementation (the proxy for the EJBObject) are both needed on the client's classpath. Each EJB vendor will also provide a JAR file (containing the classes needed for interacting with the server) which must also be placed on the client's classpath.
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!