本文介绍了Corba ORBD错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用CORBA开发一个简单的远程管理工具。这是我的服务器代码。
I am developing a simple Remote Administration Tool using CORBA. This is my server code.
/*
* 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);
}
}
}
But when I try to run the program I get following error.
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。
But the error remains. Can anyone suggest me a solution to get orbd started.
推荐答案
- 在控制台中运行orb你的系统启动orbd -ORBInitialPort 1050
- 运行YourServer.java -ORBInitialPort 1050 -ORBInitialHost localhost
- 运行YourClient.java -ORBInitialPort 1050 -ORBInitialHost localhost
很棒的教程:
这篇关于Corba ORBD错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!