Topic: JDK1.4建立CORBA应用的问题

  Print this page

1.JDK1.4建立CORBA应用的问题 Copy to clipboard
Posted by: Sam1860
Posted on: 2004-11-22 21:18

start orbd -ORBInitialPort 1050 -ORBInitialHost localhost
start java HelloServer -ORBInitialPort 1050 -ORBInitialHost localhost

在用上面命令启动服务端时出现以下错误:


org.omg.CORBA.INITIALIZE: can't instantiate default ORB implementation IE.Iona.OrbixWeb.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 HelloServer.main(HelloServer.java:37)
Caused by: java.lang.ClassNotFoundException: IE.Iona.OrbixWeb.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
HelloServer Exiting...



//HelloServer.java

import HelloApp.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;

import java.util.Properties;

class HelloImpl extends HelloPOA {
  private ORB orb;
  
  
  public void setORB(ORB orb_val) {
    orb = orb_val;
  }
  
  //implement sayHello() method
  public String sayHello() {
    return "\nHello World\n";
  }
  
  public void shutdown() {
    orb.shutdown(false);
  }
}

public class HelloServer {

  public static void main(String[] args) {
    try {
      // create and initialize the ORB
      ORB orb = ORB.init(args, null);
      
      // get reference to rootpoa & activate the POAManager
      POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
      rootpoa.the_POAManager().activate();
      
      // create servant and register it with the ORB
      HelloImpl helloImpl = new HelloImpl();
      helloImpl.setORB(orb);
      
      // get object reference from the servant
      org.omg.CORBA.Object ref = rootpoa.servant_to_reference(helloImpl);
      Hello href = HelloHelper.narrow(ref);
      
      // get the root naming context
      org.omg.CORBA.Object objRef =
        orb.resolve_initial_references("NameService");
      // Use NamingContextExt which is part of the Interoperable
      // Naming Service (INS) specification.
      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
      
      // bind the object Reference in Naming
      String name = "Hello";
      NameComponent path[] = ncRef.to_name(name);
      ncRef.rebind(path, href);
      
      System.out.println("HelloServer ready and waiting...");
      
      // wait for invocations from clients
      orb.run();
      
    } catch (Exception err) {
      System.err.println("ERROR:"+err);
      err.printStackTrace(System.out);
    }
    
    System.out.println("HelloServer Exiting...");
  }
}

2.Re:JDK1.4建立CORBA应用的问题 [Re: Sam1860] Copy to clipboard
Posted by: sothis
Posted on: 2004-11-30 21:07

-------------------
java.lang.ClassNotFoundException: IE.Iona.OrbixWeb.CORBA.ORB
-------------------
如果你使用Iona的话,请将其orb所在的包包括在classpath中
如果不打算使用Iona,请在程序中或在JDK中指明所使用的ORB产品对应的ORB类


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923