Corba ORBD错误

我正在使用CORBA开发一个简单的远程管理工具。这是我的服务器代码。

/*

* To change this template, choose Tools | Templates

* and open the template in the editor.

*/

package simrat;

import SimRATApp.SimRAT;

import SimRATApp.SimRATHelper;

import java.io.IOException;

import java.util.logging.Level;

import java.util.logging.Logger;

import javax.swing.JDialog;

import javax.swing.JOptionPane;

import org.omg.CORBA.ORB;

import org.omg.CORBA.ORBPackage.InvalidName;

import org.omg.CosNaming.NameComponent;

import org.omg.CosNaming.NamingContextExt;

import org.omg.CosNaming.NamingContextExtHelper;

import org.omg.CosNaming.NamingContextPackage.CannotProceed;

import org.omg.CosNaming.NamingContextPackage.NotFound;

import org.omg.PortableServer.POA;

import org.omg.PortableServer.POAHelper;

import org.omg.PortableServer.POAManagerPackage.AdapterInactive;

import org.omg.PortableServer.POAPackage.ServantNotActive;

import org.omg.PortableServer.POAPackage.WrongPolicy;

/**

*

* @author Rumesh

*/

public class Server {

public SimRATMain sim;

public static void main(String[] args) {

try {

try {

Runtime.getRuntime().exec("orbd -ORBInitialPort 1059 -port 1032 -ORBInitialHost localhost");

} catch (IOException ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

}

//String[] args = {};

ORB orb = ORB.init(args, null);

POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

rootpoa.the_POAManager().activate();

SimRATImpl impl = new SimRATImpl();

impl.setORB(orb);

org.omg.CORBA.Object ref = rootpoa.servant_to_reference(impl);

SimRAT href = SimRATHelper.narrow(ref);

org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");

NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

NameComponent path[] = ncRef.to_name("SimRAT");

ncRef.rebind(path, href);

System.out.println("Server Ready and waiting...");

JOptionPane.showMessageDialog(null, "Server created successfully", "SimRAT Server", 1);

orb.run();

} catch (InvalidName ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (AdapterInactive ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (ServantNotActive ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (WrongPolicy ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (org.omg.CosNaming.NamingContextPackage.InvalidName ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (NotFound ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (CannotProceed ex) {

Logger.getLogger(Server.class.getName()).log(Level.SEVERE, null, ex);

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

} catch (Exception e) {

JOptionPane.showMessageDialog(null, "Server creation failed", "SimRAT Server", 1);

}

}

}

但是,当我尝试运行程序时,出现以下错误。

Jun 14, 2014 2:54:04 PM com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>

WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 192.168.1.33; 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:2200)

at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2221)

at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:223)

at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:236)

at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:119)

at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:185)

at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:136)

at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:99)

at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(BootstrapResolverImpl.java:132)

at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:47)

at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:47)

at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:47)

at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(ORBImpl.java:1170)

at simrat.Server.main(Server.java:125)

Caused by: java.net.ConnectException: Connection refused: connect

at sun.nio.ch.Net.connect0(Native Method)

at sun.nio.ch.Net.connect(Net.java:364)

at sun.nio.ch.Net.connect(Net.java:356)

at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:623)

at java.nio.channels.SocketChannel.open(SocketChannel.java:184)

at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:78)

at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:206)

... 11 more

我尝试改变

-ORBInitialHost localhost-ORBInitialHost 192.168.1.33

但是错误仍然存​​在。谁能建议我一个开始orbd的解决方案。

回答:

  1. 在控制台中运行orb,然后系统启动orbd -ORBInitialPort 1050
  2. 运行YourServer.java -ORBInitialPort 1050 -ORBInitialHost localhost
  3. 运行YourClient.java -ORBInitialPort 1050 -ORBInitialHost本地主机

很棒的教程: 使用Java的CORBA Hello

World教程

以上是 Corba ORBD错误 的全部内容, 来源链接: utcz.com/qa/414760.html

回到顶部