Image

Imagepopcorn09 wrote in Imagejava_dev 😯confused

CORBA: Error in sample program

Hi,

I am using openORB 1.3.0 and JDK 1.4.2 to run a sample program given on Sun's Java website. The same code is running on a friend's computer but throws an error on my computer. Also, if I replace the naming service code and use Stringified object references, it works perfectly ok. As a naming service, I am using orbd and specify the InitialPort and InitialHost while initialising it and give the same parameters in command line arguments for the server.

Can anyone think of a reason why this is not working and what could be changed to possibly make it work?

I am pasting the code and the run-time error. The code compiles ok.

Thanks for any help anybody can offer


import org.omg.CORBA.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContext;
import org.omg.CosNaming.NamingContextHelper;

import HelloApp.HelloCallback;
import HelloApp.*;

class HelloServant extends _HelloImplBase {
 public String sayHello(HelloCallback callobj, String msg) {
  callobj.callback(msg);
  return "\nHello world !!\n";
 }
}

public class server {
 public static void main(String args[]) {
  try {
   // create and initialize the ORB           
   ORB orb = ORB.init(args, null);
   // create servant and register it with the ORB
   HelloServant helloRef = new HelloServant();
   orb.connect(helloRef);
   // get the root naming context           
   org.omg.CORBA.Object objRef = orb
     .resolve_initial_references("NameService");
   NamingContext ncRef = NamingContextHelper.narrow(objRef);
   // bind the Object Reference in Naming 
   NameComponent nc = new NameComponent("Hello", "");
   NameComponent path[] = { nc };
   ncRef.rebind(path, helloRef);
   // wait for invocations from clients
   java.lang.Object sync = new java.lang.Object();
   synchronized (sync) {
    sync.wait();
   }
  } catch (Exception e) {
   System.err.println("ERROR: " + e);
   e.printStackTrace(System.out);
  }
 }

}


ERROR: org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.openorb.CORBA.ORB vmcid: 0x0 minor code: 0 completed: No
org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation org.openorb.CORBA.ORB vmcid: 0x0 minor code: 0 completed: No
at org.omg.CORBA.ORB.create_impl(ORB.java:297)
at org.omg.CORBA.ORB.init(ORB.java:336)
at server.main(server.java:21)

Caused by: java.lang.ClassNotFoundException: org.openorb.CORBA.ORB
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at org.omg.CORBA.ORB.create_impl(ORB.java:295)
... 2 more