File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Client Accessing EJBs from Different Physical App Servers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Client Accessing EJBs from Different Physical App Servers" Watch "Client Accessing EJBs from Different Physical App Servers" New topic
Author

Client Accessing EJBs from Different Physical App Servers

Patrick Nolan
Greenhorn

Joined: Oct 03, 2003
Posts: 17
Here's the scenario..
App Server A has Entity Bean A
App Server B has Entity Bean B
App Server C has POJO C (acting as a DAO)
I want the entity bean implementations to remain on their respective servers. I want C to access remote interfaces of A and B and perform typical CRUD operations on each. How does C access entities A and B? Do I need to have A and B code on App Server C? If so, how must it be packaged? All I was able to find out is how to configure the rmi.xml on each of the three servers so that they can communicate. That's as far as I got
Sergiu Truta
Ranch Hand

Joined: Dec 16, 2003
Posts: 121
First of all, you shouldn't access your entity beans through the Remote interface. You should use a session facade (client-->Session Bean-->Entity Bean) or message facade (if your system is asyncronous).
From your server C you should access these Session Beans. How to do that depends on the App Server you are using...some may create a client.jar which (depending on the jars containing the EJBs) contains the stubs for your beans.
It would be better for you if you look for an example of how to connect remotely to beans for your application server.
And of course, you have the second option, telling us what app server you use and we might try and help.


...watch me...as I'm walking the path...
Patrick Nolan
Greenhorn

Joined: Oct 03, 2003
Posts: 17
For simplicity's sake, I left out such details as Session Facades... but thanks for your input. Now, back on the topic of distribution. The app server is 9ias, but I didn't think that mattered, since distribution is part of the J2EE spec and thus applicable to all j2ee servers(?). I *did* find examples of how to put the entire ejb jar on a different server.. but what I want to do is somewhat different. I want to have some ejbs on one server and other ejbs on another server. I didn't find anything on how to configure that.
Maulin Vasavada
Ranch Hand

Joined: Nov 04, 2001
Posts: 1871
Hi Patrick,
Well, if beans are on physically different servers then I would not try to access even the remote interfaces or session beans via session facade..
I would write a servlet on each app server that mediates b/w the external requests to access the beans and all and use may be urlconnection or something to pass around things...The reason is this enables us to change names or session beans or entity beans etc on different servers. NOw, I don't know how good idea is to make urlconnection ...but my point is to keep things separate/decoupled if they are physically separate....
Regards
Maulin
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi Maulin,
>>Well, if beans are on physically different servers then I would not try to access even the remote interfaces or session beans via session facade..
>>I would write a servlet on each app server that mediates b/w the external requests to access the beans and all and use may be urlconnection or something to pass around things...The reason is this enables us to change names or session beans or entity beans etc on different servers. NOw, I don't know how good idea is to make urlconnection ...but my point is to keep things separate/decoupled if they are physically separate....
As per as Patrick's requirement any client on App Server C say has to access the 2 Entity Beans on App Server A and B respectively.
Though this may not be the Clustered Server kind of an environment, still the return values of any business methods needs to be obtained and used in the App Server C's business method.
Normal remote lookup for each of the Entity bean on the 2 app server should take care of the same though I have no code to prove it in actual as difficult to have a setup like this.
Rgds,
Seetesh
Seetesh Hindlekar
Ranch Hand

Joined: Feb 13, 2004
Posts: 244
Hi Patrick,
POJO on App Server C can access the 2 EB defined on the 2 App Servers A and B provided the 2 EB are defined as Remote and not Local.
If u have already tried this, pls mention if u've faced any problems.
I have done it using a App Server having Weblogic 8.1 whereas my comp has Weblogic 7.0 installed.
My Remote Stateless Bean acting as a client could remotely access the Remote Entity Bean defined on the 8.1 App Server and execute the business methods on the same.
Is this what you were looking for or is ur requirement different that what I had tried.
Rgds,
Seetesh
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Client Accessing EJBs from Different Physical App Servers
 
Similar Threads
A design in practise
newbie question..
question about server port number
Read only Entity beans?
long post IBM.158