有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java Corba,在两台机器上运行Hello World

我试图在两台机器上运行一个简单的客户机-服务器程序

我读了这篇page,但我发现了以下错误:

Jun 04, 2012 6:43:10 PM com.sun.corba.se.impl.transport.SocketOrChannelConnectio
nImpl <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR
_TEXT; hostname: xx.xx.xx.xx; port: 1050"
org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No
        at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
        at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(Unknown Source)
        at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(Unknown Source)
        at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(Unknown Source)
        at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(Unknown Source)
        at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(Unknown Source)
        at HelloClient.main(HelloClient.java:17)
Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at java.nio.channels.SocketChannel.open(Unknown Source)
        at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(Unknown Source)
        ... 12 more

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(Unknown Source)
        at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unknown Source)
        at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(Unknown Source)
        at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(Unknown Source)
        at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(Unknown Source)
        at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(Unknown Source)
        at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(Unknown Source)
        at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(Unknown Source)
        at HelloClient.main(HelloClient.java:17)
Caused by: java.net.ConnectException: Connection refused: connect
        at sun.nio.ch.Net.connect0(Native Method)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.Net.connect(Unknown Source)
        at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
        at java.nio.channels.SocketChannel.open(Unknown Source)
        at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(Unknown Source)
        ... 12 more

您能告诉我如何使用Corba和java在internet上的两台机器上运行像“Hello Wrold”这样的简单程序吗

问候


共 (2) 个答案

  1. # 1 楼答案

    1. 运行orbstart orbd -ORBInitialPort 1050
    2. 使用以下命令运行类客户端和服务器:-ORBInitialPort 1050 -ORBInitialHost localhost

    或其他选择: 1.运行服务器: tnameserv-ORBInitialPort 1050

    1. 运行客户端: java YourServer-ORBInitialPort 1050 java YourClient-ORBInitialHost 127.0.0.1-ORBInitialPort 1050

    a similar problem

  2. # 2 楼答案

    how can i run a simple program like " Hello Wrold " on two machines over internet using Corba and java?

    我认为互联网上的是关键。你需要确保:

    1. 客户端可以通过指定的IP地址访问服务器(即IP地址是公共的,或者在任何相关防火墙上设置了适当的屏蔽规则)
    2. 有适当的防火墙和/或端口转发规则,允许客户端访问服务器上的端口1050

    我建议在同一子网上运行时,首先让客户机和服务器工作,然后再转到分布式设置