Win a copy of The Way of the Web Tester: A Beginner's Guide to Automating Tests this week in the Testing forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Bean to Bean communication

Praveena Venigalla
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two beans namely BeanA and BeanB. BeanA is in one application server and BeanB is in other application server.BeanA is developed by a group.
I am developing BeanB.From BeanB I need to call BeanA.I have clientEJB jar file of BeanA.I am able to create homeObject. But unable to create remoteObject. Do I need to set any properties? Or anything wrong in my code?

The code is as follows:
System.out.println(�Creating the Home Object�);
homeObj = null;
Properties env = new Properties();
env.put(Context.PROVIDER_URL, JNDIServer);
env.put("", "none"); InitialContext ctx = new InitialContext(env); System.out.println(" P1");
Object obj =ctx.lookup(EJBName);
//creating home object for BeanA
homeObj =(BeanAHome)javax.rmi.PortableRemoteObject.narrow(obj,BeanAHome.class);
System.out.println("home object created successfully");
//creating remote object for BeanA;
BeanA remote = homeObj.create();
System.out.println(�remote object created successfully�);

}catch(NamingException nex){
} catch(RemoteException rex){
} catch(CreateException cex){

I got this output:
Creating the Home Object
[7/29/04 9:20:12:607 CDT] 626e86e5 SystemOut O P1
[7/29/04 9:20:13:038 CDT] 626e86e5 SystemOut O P2
[7/29/04 9:20:13:038 CDT] 626e86e5 SystemOut O home object created successfully
[7/29/04 9:20:13:078 CDT] 626e86e5 SystemOut O CORBA TRANSIENT 0x4942f301 No; nested exception is:

org.omg.CORBA.TRANSIENT: A remote host refused an attempted connect operation.:host=localhost,port=4875 minor code: 4942F301 completed: No

Your help is greatly appreciated.
Thanks a lot.
parthiban subramaniam
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
let me get this properly,
you have said you have 2 app servers,
I assume that it that they are hosted in 2 diffrent machines or they are configured so that there is no port conflict even if they are hosted in the same machine,
check your way of creating the initiacontext first,
from you code i dont see 2 initialcontext been used,
both the server can not have the same provider url to start with

check your code properly once more and try to work with just your own ejb before you do a look up on the other one

  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic