CORBA orb.resolve_initial_references("ORBPolicyManager");不工作

Posted

技术标签:

【中文标题】CORBA orb.resolve_initial_references("ORBPolicyManager");不工作【英文标题】:CORBA orb.resolve_initial_references("ORBPolicyManager"); not Working 【发布时间】:2014-05-15 13:10:24 【问题描述】:

我的项目在到达 org.omg.CORBA.Object obj = orb.string_to_object(stringTarget); 时崩溃 并向我抛出一个异常,上面写着:“org.omg.CORBA.COMM_FAILURE:vmcid:SUN 次要代码:201 已完成:否”。 任何可能导致此错误的想法。 服务器在线,我可以 Ping 它。 我的 IOR 文件已更新。

  Properties props = System.getProperties();

        props.put("org.openorb.PI.FeatureInitializerClass.org.openorb.orb.messaging.MessagingInitializer","");
        props.put("ORBClass", "org.openorb.orb.core.ORB");
        props.put("iiop.port", ParameterUtil.getInstance().getOrbClientPort());
        props.put("iiop.useNativeLibrary", "true");

        // Inicializa o ORB
        if (orb == null) 
            synchronized (semaforo) 
                if (orb == null)
                    orb = ORB.init(args, props);
            
            logger.info("ORB inicializado.");
        



                    FileInputStream file = new FileInputStream(Constantes.IOR_FILE_PATH);

        BufferedReader myInput = new BufferedReader(new java.io.InputStreamReader(file));
        String stringTarget =  myInput.readLine();
        logger.debug("IOR used is :" + stringTarget);

        org.omg.CORBA.Object obj = orb.string_to_object(stringTarget);

        // Definição de politica de timeout no ORB
        try 
            PolicyManager opm = (PolicyManager) orb.resolve_initial_references("ORBPolicyManager");
            Any time_any = orb.create_any();
            // convert from 1ms to 100ns
            org.omg.TimeBase.TimeTHelper.insert(time_any, orbTimeout * 1000 * 10);
            Policy[] policies = new Policy[1];
            policies[0] = orb.create_policy(org.omg.Messaging.RELATIVE_RT_TIMEOUT_POLICY_TYPE.value, time_any);
            opm.set_policy_overrides(policies,
                    SetOverrideType.ADD_OVERRIDE);
         catch (InvalidName invname_ex) 
            logger.error("ORBPolicyManager wasn't found! (" + invname_ex + ")");
         catch (PolicyError pol_ex) 
            logger.error("A policy error occured: " + pol_ex + " - Reason Code: " + pol_ex.reason, pol_ex);
         catch (InvalidPolicies invpol_ex) 
            logger.error("An invalid policy has been specified: " + invpol_ex);
        

这里是完整的 StackTrace

 com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init>
AVISO: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 10.40.56.100; 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:205)
    at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:218)
    at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:101)
    at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:171)
    at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:118)
    at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:74)
    at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(BootstrapResolverImpl.java:107)
    at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
    at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
    at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:22)
    at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(ORBImpl.java:1151)
    at com.gvt.oss.nec.pool.net.dslam.ZhoneGateway.init(ZhoneGateway.java:232)
    at com.gvt.oss.nec.pool.net.dslam.ZhoneGateway.<init>(ZhoneGateway.java:194)
    at com.gvt.oss.nec.pool.factory.GatewayFactory.getSession(GatewayFactory.java:12)
    at com.gvt.oss.nec.pool.facade.SessionExecutionFacade.openSession(SessionExecutionFacade.java:27)
    at corba.Corba.main(Corba.java:27)
Caused by: java.net.ConnectException: Connection refused: connect

    at sun.nio.ch.Net.connect(Native Method)
    at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:500)
    at java.nio.channels.SocketChannel.open(SocketChannel.java:146)
    at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:60)
    at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:188)
    ... 15 more
javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file:  java.naming.factory.initial
    at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
    at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
    at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:325)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at com.gvt.oss.nec.pool.util.Datasource.loadDataSource(Datasource.java:54)
    at com.gvt.oss.nec.pool.util.Datasource.getConnection(Datasource.java:73)
    at com.gvt.oss.nec.pool.business.ManagerAudit.<init>(ManagerAudit.java:46)
    at com.gvt.oss.nec.pool.business.ManagerAudit.getInstance(ManagerAudit.java:65)
    at com.gvt.oss.nec.pool.facade.SessionExecutionFacade.corbaExecCommandSession(SessionExecutionFacade.java:105)
    at corba.Corba.main(Corba.java:28)
15/05/2014 10:03:18 corba.Corba main
GRAVE: null
com.gvt.oss.nec.pool.exception.RemotePoolException: Erro geral ao processar requisição de comando Corba: null
    at com.gvt.oss.nec.pool.facade.SessionExecutionFacade.corbaExecCommandSession(SessionExecutionFacade.java:102)
at corba.Corba.main(Corba.java:28)

【问题讨论】:

【参考方案1】:

你需要define this property:

java.naming.factory.initial

根据错误信息

需要在环境或系统属性中指定类名,或者作为 applet 参数,或在应用程序资源文件中: java.naming.factory.initial

【讨论】:

我不确定这是根本原因。该错误看起来像是由于堆栈跟踪中更深层次的其他错误而引发的。这是我要关注的(COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 10.40.56.100; port: 900【参考方案2】:
    运行 orb start orbd -ORBInitialPort 1050tnameserv -ORBInitialPort 1050 运行您的课程客户端和服务器:-ORBInitialPort 1050 -ORBInitialHost localhost

a similar problem

【讨论】:

以上是关于CORBA orb.resolve_initial_references("ORBPolicyManager");不工作的主要内容,如果未能解决你的问题,请参考以下文章

CORBA:如何将 QT 对象作为参数传递

org.omg.CORBA:MARSHAL & org.omg.CORBA.BAD_PARAM 错误

Corba 客户端 - Python 和 Corba 服务器 - Java

复制包含字符串的 CORBA::Any 时 CORBA 程序段错误

corba 实现它们在哪里找到

在 CORBA 程序中调用 createEntityManager 会导致异常:org.omg.CORBA.OBJECT_NOT_EXIST