File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Distributed Java and the fly likes Client/server application using CORBA Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Client/server application using CORBA" Watch "Client/server application using CORBA" New topic

Client/server application using CORBA

Niranjani Manoharan

Joined: Apr 14, 2008
Posts: 25
The specifications of the server side application that i have to write are as follows:
Server 1 - �Simple Server�
The first POA-based server you need to develop is the �simple server�. This server should perform the
following tasks:
1. Start a timer
2. Create 1,000 Count objects with names �My Count1� ... �My Count1000�, and activate each object at
the time of its creation
3. Stop the timer and print out the average time to create and activate each counter
4. Register each Count object with the Naming Service (you do not need to time how long this operation
5. Wait for client requests
Note that this server does not use a servant manager.

The server program i have written is as follows which shows an error at the creation of count servant.I want to know how to debug it:

// The Simple Server main program

import org.omg.PortableServer.*;
import org.omg.CosNaming.*;

class SimpleServer
{ public static void main(String[] args)



{ // Initialize the ORB
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);

// get a reference to the root POA
POA rootPOA =

// Create policies for our persistent POA
org.omg.CORBA.Policy[] policies = {

// Create myPOA with the right policies
POA myPOA = rootPOA.create_POA( "count_poa", rootPOA.the_POAManager(),
policies );

//Start the timer
for(int i=0;i<1000;i++)

// Calculate Start time
long startTime = System.currentTimeMillis();

// Create the servant
CountPOAServant countServant = new CountPOAServant();

//Create the object id
MyCount[] c=new MyCount[i];

// Decide on the ID for the servant
byte[] countId = "Count".getBytes();

// Activate the servant with the ID on myPOA
myPOA.activate_object_with_id(countId, countServant);
// Activate the POA manager

// Calculate stop time; print out statistics
long stopTime = System.currentTimeMillis();
System.out.println("Avg Ping = "
+ ((stopTime - startTime)/1000f) + " msecs");


// get a reference to the Naming Service root context
org.omg.CORBA.Object nameServiceObj =
if (nameServiceObj == null)
System.out.println("nameServiceObj = null");

NamingContextExt nameService =
if (nameService == null)
System.out.println("nameService = null");

// bind the Count object in the Naming service
NameComponent[] countName = {new NameComponent("MyCount", "")};
+ " is ready.");
// Wait for incoming requests
System.out.println( orb.object_to_string( myPOA.servant_to_reference(countServant)));;

} catch(Exception e)
{ System.err.println(e);

Thanks & Regards, Niranjani
Anusha Mapati

Joined: Sep 28, 2011
Posts: 2
Hey there,

Did you happen to find the solution to your problem because I'm facing the same issue.

Harry Nandy

Joined: Oct 22, 2013
Posts: 2
Can anyone please help me find solution for this? I am not able to start on this.
I agree. Here's the link:
subject: Client/server application using CORBA
It's not a secret anymore!