Corba ORBD 错误
Posted
技术标签:
【中文标题】Corba ORBD 错误【英文标题】:Corba ORBD error 【发布时间】:2014-06-14 09:29:32 【问题描述】:我正在使用 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 的解决方案。
【问题讨论】:
您是否启动了“orbd”计划? 我正在使用这一行启动 orbd 程序。那是发生错误的行。 Runtime.getRuntime().exec("orbd -ORBInitialPort 1059 -port 1032 -ORBInitialHost localhost"); 不,不是。查看堆栈跟踪。 Runtime.exec() 没有出现在它的任何地方。当您调用 resolve_initial_references() 时会发生这种情况。 似乎没有执行。我尝试在命令提示符下启动 orbd 并得到同样的错误。你知道为什么吗? 您从这个程序或从 orbd 得到了同样的错误?为什么要将所有这些端口指定为 orbd 而不是您自己的代码!尝试不使用所有端口参数。 【参考方案1】:-
在控制台中运行 orb 你的系统 start orbd -ORBInitialPort 1050
运行 YourServer.java -ORBInitialPort 1050 -ORBInitialHost localhost
运行 YourClient.java -ORBInitialPort 1050 -ORBInitialHost localhost
很棒的教程: Tutorial for CORBA Hello World using Java
【讨论】:
谢谢。我什至忘记了我在 SO 上问过这个问题。 :D :D以上是关于Corba ORBD 错误的主要内容,如果未能解决你的问题,请参考以下文章
将 CORBA orbd-Name 服务安装为 Windows 服务