This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Client Accessing EJBs from Different Physical App Servers

 
Patrick Nolan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Patrick Nolan
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic