局域网上的CORBA查找挂起 [英] CORBA lookup on a LAN hangs

查看:151
本文介绍了局域网上的CORBA查找挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何特定的Glassfish配置允许通过局域网进行远程CORBA查找?或者,也许,路由器防火墙需要配置吗?



如何排查此连接?



CORBA查询客户端只是挂起:

 建立成功
总时间:3秒
2014年11月22日上午3:45:26 aggregatorclient.AggregatorClient remoteEJB
警告:{org.omg.CORBA.ORBInitialPort = 3700,java.naming.factory.initial = com.sun.enterprise.naming.impl.SerialInitContextFactory,Context.SECURITY_CREDENTIALS = pass123,org.omg.CORBA.ORBInitialHost = 192.168 .0.119,java.naming.factory.url.pkgs = com.sun.enterprise.naming,java.naming.factory.state = com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl,Context.SECURITY_PRINCIPAL = user1当从本地主机(即从本地主机,连接到本地主机)运行时,一切都在同一个地方电脑,连接工作正常。



CORBA连接看起来在 jndi.properties 中:

  java.naming.factory .initial = com.sun.enterprise.naming.SerialInitContextFactory 
java.naming.factory.url.pkgs = com.sun.enterprise.naming
java.naming.factory.state = com.sun.corba .ee.impl.presentation.rmi.JNDIStateFactoryImpl
Context.SECURITY_PRINCIPAL = user1
Context.SECURITY_CREDENTIALS = pass123
org.omg.CORBA.ORBInitialHost = 192.168.0.119
org.omg .CORBA.ORBInitialPort = 3700

连接客户端代码:

  package aggregatorclient; 

导入dur.ejb.AnswerSessionBeanRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class AggregatorClient {

private static final Logger log = Logger.getLogger(AggregatorClient.class.getName());

public static void main(String [] args){
try {
new AggregatorClient()。remoteEJB();
} catch(NamingException ex){
Logger.getLogger(AggregatorClient.class.getName()).log(Level.SEVERE,null,ex);



private void remoteEJB()throws NamingException {
Context ctx = new InitialContext();
log.warning(ctx.getEnvironment()。toString());
Object obj = ctx.lookup(dur.ejb.AnswerSessionBeanRemote);
AnswerSessionBeanRemote asbr =(AnswerSessionBeanRemote)obj;
log.info(answer\t+ asbr.lifeTheUniverseAndEverything());
}

}

client 用Glassfish appclient 执行。


在远程主机上运行的独立ejb客户端具有相同的永远悬挂的查找行为。解决方案

事实证明,这与服务器主机将自己的主机名解析为自己的非回送地址的能力有关。我通过在 / etc / hosts 中添加/修复条目来解决它:

  10.0.10.102 my-server-hostname 

我检查了服务器实际上可以解析正确的IP地址与主机名-i

  $主机名-i 
10.0.10.102

重新启动GlassFish后,远程查找和EJB调用的工作就像一个魅力! p>

说明



我在嗅探客户端和服务器之间的流量后发现此解决方案。底层协议是GIOP(从来没有听说过)。

执行远程查询时,我的客户端请求 实际上可以达到GlassFish 。但服务器回复了一个误导性的位置转发响应,指出 127.0.1.1 IIOP:Profile_host 127.0.1.1 是我在修复 / etc / hosts 之前解析到的服务器主机名的环回IP地址。


Is there any specific Glassfish configuration required to allow remote CORBA lookup across a LAN? Or, does, perhaps, the routers firewall need configuration?

How do I troubleshoot this connection?

The CORBA lookup client just hangs:

BUILD SUCCESSFUL
Total time: 3 seconds
Nov 22, 2014 3:45:26 AM aggregatorclient.AggregatorClient remoteEJB
WARNING: {org.omg.CORBA.ORBInitialPort=3700, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, Context.SECURITY_CREDENTIALS=pass123, org.omg.CORBA.ORBInitialHost=192.168.0.119, java.naming.factory.url.pkgs=com.sun.enterprise.naming, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, Context.SECURITY_PRINCIPAL=user1}

When run from localhost (ie, from localhost, connecting to localhost), with everything on the same computer, the connection works fine.

The CORBA connection lookup parameters, in jndi.properties:

java.naming.factory.initial=com.sun.enterprise.naming.SerialInitContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl
Context.SECURITY_PRINCIPAL=user1
Context.SECURITY_CREDENTIALS=pass123
org.omg.CORBA.ORBInitialHost=192.168.0.119
org.omg.CORBA.ORBInitialPort=3700

the connecting clients code:

package aggregatorclient;

import dur.ejb.AnswerSessionBeanRemote;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

public class AggregatorClient {

    private static final Logger log = Logger.getLogger(AggregatorClient.class.getName());

    public static void main(String[] args) {
        try {
            new AggregatorClient().remoteEJB();
        } catch (NamingException ex) {
            Logger.getLogger(AggregatorClient.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    private void remoteEJB() throws NamingException {
        Context ctx = new InitialContext();
        log.warning(ctx.getEnvironment().toString());
        Object obj = ctx.lookup("dur.ejb.AnswerSessionBeanRemote");
        AnswerSessionBeanRemote asbr = (AnswerSessionBeanRemote) obj;
        log.info("answer\t" + asbr.lifeTheUniverseAndEverything());
    }

}

The client is executed with Glassfish appclient.

解决方案

Been having the same "hanging forever" lookup behavior with a standalone ejb client running on a remote host. It turned out to be related to the server host's ability to resolve its own hostname into its own non-loopback address. I resolved it by adding / fixing an entry in /etc/hosts:

10.0.10.102    my-server-hostname

I checked that the server could actually resolve the right ip address with hostname -i :

$ hostname -i
10.0.10.102

After restarting GlassFish, remote lookup and call to EJB worked like a charm!

Explanation

I found this solution after sniffing the traffic between my client and server. The underlying protocol is GIOP (had never heard of it).

When executing the remote lookup, my client's request was actually able to reach GlassFish. But the server replied with a misleading "Location Forward" response, indicating 127.0.1.1 as a IIOP:Profile_host. 127.0.1.1 was the loopback ip address that my server's hostname resolved to before I fixed the /etc/hosts.

这篇关于局域网上的CORBA查找挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆