日期:2014-05-20  浏览次数:20891 次

远程连接corba 服务器的问题
import org.omg.CORBA.ORB;
import org.omg.CosNaming.NamingContextExt;
import org.omg.CosNaming.NamingContextExtHelper;
import HelloApp.Hello;
import HelloApp.HelloHelper;
public class HelloClient
{
  static Hello helloImpl;
  public static void main(String args[]){
  try{
  // create and initialize the ORB
  String[] a={"–ORBInitialPort","80","–ORBInitialHost","10.88.129.155"};
// String nameservice = "corbaloc::10.88.129.155:5555/NameService"; 
// String[] a={"-ORBInitRef", "NameService="+nameservice };
  ORB orb = ORB.init(a, null);
  System.out.println("ORB initialised\n");
   
  // get the root naming context
  org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
  // Use NamingContextExt instead of NamingContext, 
  // part of the Interoperable naming Service.  
  NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
 
  // resolve the Object Reference in Naming
  String name = "Hello1";
  helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
   
  // System.out.println("Obtained a handle on server object: " + helloImpl);
  System.out.println(helloImpl.sayHello());
  //helloImpl.shutdown();
  } 
  catch (Exception e) {
  System.out.println("ERROR : " + e) ;
  e.printStackTrace(System.out);
  } 
  } //end main
} // end class

//地址明明写的是10.88.129.155 端口号明明写80结果异常如下
ORB initialised

ERROR : org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2172)
2009-12-11 14:47:40 com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
警告: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 10.88.129.159; port: 900"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2172)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2193)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:205)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:218)
at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:101)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:152)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:118)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:74)
at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(BootstrapResolverImpl.java:107)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(ORBImpl.java:1155)
at HelloClient.main(HelloClient.java:20)
Caused by: java.net.ConnectException: Connection refused: connect