dcsimg
I am not able to initialize ORB multiple times using RMI over IIOP.
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sriram_Piratla
Posted On:   Thursday, September 29, 2005 09:59 AM

I wanted to use RMI over IIOP in my project. To get hands on, i have written a sample program using j2sdk1.4.2_09 and followed the same steps listed at http://java.sun.com/j2se/1.4.2/docs/guide/idl/orbd.html to start the server. It is working fine if i don't initialize the ORB multiple times (i.e Only once.). But When i tried to intialize ORB multiple times it is throwing the following exception at the time of registering the server through servertool. ErrorLog: org.omg.CORBA.INITIALIZE: vmcid: SUN minor code: 1004 completed: Maybe at com.sun.corba.se.internal.POA.POAORB.initPostProcessing(P   More>>



I wanted to use RMI over IIOP in my project. To get hands on, i have written a sample program
using j2sdk1.4.2_09 and followed the same steps listed at
http://java.sun.com/j2se/1.4.2/docs/guide/idl/orbd.html to start the server.







It is working fine if i don't initialize the ORB multiple times (i.e Only once.). But When i tried
to intialize ORB multiple times it is throwing the following exception at the time of registering
the server through servertool.



ErrorLog:







org.omg.CORBA.INITIALIZE: vmcid: SUN minor code: 1004 completed: Maybe

at com.sun.corba.se.internal.POA.POAORB.initPostProcessing(POAORB.java:369)

at com.sun.corba.se.internal.Interceptors.PIORB.initPostProcessing(PIORB.java:232)

at com.sun.corba.se.internal.POA.POAORB.set_parameters(POAORB.java:185)

at com.sun.corba.se.internal.Interceptors.PIORB.set_parameters(PIORB.java:333)

at org.omg.CORBA.ORB.init(ORB.java:337)

at Server.main(Server.java:18)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

at java.lang.reflect.Method.invoke(Method.java:324)

at com.sun.corba.se.internal.Activation.ServerMain.run(ServerMain.java:260)

at com.sun.corba.se.internal.Activation.ServerMain.main(ServerMain.java:273)




Output Log:




[Wed Sep 28 15:28:55 EDT 2005] Server started

First time com.sun.corba.se.internal.Interceptors.PIORB@1543c88

[Wed Sep 28 15:28:55 EDT 2005] Install starting

[Wed Sep 28 15:28:55 EDT 2005] Install completed





Source Code:






			
// Server.java
import org.omg.PortableServer.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;

public class Server {

public static void main(String[] args) {
try {
// Initialize the ORB for the first time.
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);
System.out.println(" First time "+ orb);

//Initialize the ORB for the second time.
org.omg.CORBA.ORB orb1 = org.omg.CORBA.ORB.init(args,null); // ---- > Throwing Exception here ....
System.out.println("Second Time "+orb1);

// get a reference to the root POA
POA rootPOA = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
// get a reference to the Naming Service root_context
org.omg.CORBA.Object rootObj = orb.resolve_initial_references("NameService");
NamingContextExt root = NamingContextExtHelper.narrow(rootObj);

// Create policies for our persistent POA
org.omg.CORBA.Policy[] policies = {
rootPOA.create_lifespan_policy(LifespanPolicyValue.PERSISTENT)
};
// Create myPOA with the right policies
POA myPOA = rootPOA.create_POA( "bank_agent_poa", rootPOA.the_POAManager(),
policies );
// Create the servant
AccountManagerImpl managerServant = new AccountManagerImpl();
// Decide on the ID for the servant
byte[] managerId = "BankManager".getBytes();
// Activate the servant with the ID on myPOA
myPOA.activate_object_with_id(managerId, managerServant);

// Activate the POA manager
rootPOA.the_POAManager().activate();
// Associate the bank manager with the name at the root context
// Note that casting is needed as a workaround for a JDK 1.1.x bug.
((NamingContext)root).bind(root.to_name("BankManager"), myPOA.servant_to_reference(managerServant));
System.out.println(myPOA.servant_to_reference(managerServant) + " is ready.");
// Wait for incoming requests
orb.run();
}
catch (Exception e) {
e.printStackTrace();
}
}
}





Any help/suggestions in this regard is highly appreciated.

   <<Less

Re: I am not able to initialize ORB multiple times using RMI over IIOP.

Posted By:   Anonymous  
Posted On:   Monday, November 21, 2005 09:38 PM

First, why are connecting to the same ORB, with the same args? Also, what args are you sending to the ORB.init method?
About | Sitemap | Contact