简体   繁体   English

使用JacORB客户端超时策略的“ org.omg.CORBA.BAD_OPERATION:无法提取ulonglong”

[英]“org.omg.CORBA.BAD_OPERATION: Cannot extract ulonglong” with JacORB client timeout policy

I'm trying to implement a client timeout policy for a CORBA connection using JacORB with java. 我正在尝试使用带有Java的JacORB为CORBA连接实现客户端超时策略。 Following is the first method I tried to implement this 以下是我尝试实现的第一种方法

long timeout = 10000000L;
org.omg.CORBA.Any relativeRoundtripTimeoutValue = orb.create_any();
TimeTHelper.insert(relativeRoundtripTimeoutValue,timeout);
Policy[] policies = new Policy[1];
try {
    policies[0] = orb.create_policy(org.omg.Messaging.RELATIVE_RT_TIMEOUT_POLICY_TYPE.value,
                                        relativeRoundtripTimeoutValue);
    <client_stub>._set_policy_override(policies, SetOverrideType.ADD_OVERRIDE);
} catch (PolicyError e) {
    e.printStackTrace();
}

This implementation throws 该实现抛出

Caused by: org.omg.CORBA.BAD_OPERATION: Cannot extract ulonglong  vmcid: 0x0  minor code: 0     completed: No
at org.jacorb.orb.Any.checkExtract(Any.java:118)
at org.jacorb.orb.Any.extract_ulonglong(Any.java:467)
at org.jacorb.orb.policies.RelativeRoundtripTimeoutPolicy.<init>(RelativeRoundtripTimeoutPolicy.java:58)
at org.jacorb.orb.ORB.create_policy(ORB.java:774)

But when I change RELATIVE_RT_TIMEOUT_POLICY_TYPE to REPLY_END_TIME_POLICY_TYPE this runs without an exception but did not yield the expected result as client waited without timing out. 但是,当我将RELATIVE_RT_TIMEOUT_POLICY_TYPE更改为REPLY_END_TIME_POLICY_TYPE时,它会毫无例外地运行,但由于客户端等待超时而没有产生预期的结果。

I tried following approach also and it ran without an exception but again the client waited indefinitely without timing out. 我也尝试了以下方法,该方法毫无例外地运行,但是客户端再次无限期地等待而不会超时。

Policy retquestTimeoutPolicy = new org.jacorb.orb.policies.RelativeRoundtripTimeoutPolicy (1000 * 10000);
applicationDataAccess._set_policy_override(new Policy[]{retquestTimeoutPolicy}, SetOverrideType.ADD_OVERRIDE);

I may be missing some small thing here but I'm new to corba flows. 我可能在这里错过了一些小东西,但是我对corba flow不熟悉。 so any help will be great. 所以任何帮助都会很棒。

To set this policy, you should use set_policy_overrides method of the PolicyManager object: 要设置此策略,应使用PolicyManager对象的set_policy_overrides方法:

  long timeout = 10000000L;
  PolicyManager opm = (PolicyManager) orb.resolve_initial_references("ORBPolicyManager");
  Any relativeRoundtripTimeoutValue = orb.create_any();
  TimeTHelper.insert(relativeRoundtripTimeoutValue, timeout);
  Policy[] policies = new Policy[1];
  policies[0] = orb.create_policy(RELATIVE_RT_TIMEOUT_POLICY_TYPE.value,
      relativeRoundtripTimeoutValue);
  opm.set_policy_overrides(policies, SetOverrideType.ADD_OVERRIDE);

There is an example in the OpenORB sources https://sourceforge.net/projects/openorb/files/OpenORB/1.4.0/OpenORB-1.4.0-src.zip/download : \\OpenORB\\src\\examples\\org\\openorb\\orb\\examples\\messaging\\Client.java OpenORB源中有一个示例https ://sourceforge.net/projects/openorb/files/OpenORB/1.4.0/OpenORB-1.4.0-src.zip/download:\\ OpenORB \\ src \\ examples \\ org \\ openorb \\ ORB \\例子\\消息\\ Client.java

When you set an override it applies to the new object eg 设置替代时,它将应用于新对象,例如

new_object_with_policy = applicationDataAccess._set_policy_override(.... new_object_with_policy = applicationDataAccess._set_policy_override(....

Try doing that ? 尝试这样做?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在java中解决错误org.omg.CORBA.BAD_OPERATION异常? - How to resolve Error org.omg.CORBA.BAD_OPERATION exception in java ? 本地JacORB调用:org.omg.CORBA.OBJECT_NOT_EXIST - Local JacORB call: org.omg.CORBA.OBJECT_NOT_EXIST 使用CORBA连接客户端(在VirtualBox上)和服务器(在localhost上)-org.omg.CORBA.BAD_PARAM: - Connecting client (on VirtualBox) and server (on localhost) using CORBA - org.omg.CORBA.BAD_PARAM: org.omg.CORBA:MARSHAL和org.omg.CORBA.BAD_PARAM错误 - org.omg.CORBA:MARSHAL & org.omg.CORBA.BAD_PARAM error 使用JacORB(Java / CORBA)和SSL的客户端策略错误 - Client-side policy error using JacORB (Java/CORBA) with SSL 无法从org.omg.CORBA.TRANSIENT恢复(成为永久性) - Cannot recover from org.omg.CORBA.TRANSIENT (becomes permanent) Corba:无法将org.omg.CosNaming._NamingContextStub强制转换为org.omg.CosNaming.NamingContextExt - Corba: org.omg.CosNaming._NamingContextStub cannot be cast to org.omg.CosNaming.NamingContextExt org.omg.CORBA.ORBPackage.InvalidName: IDL:omg.org/CORBA/ORB/InvalidName:1.0 - org.omg.CORBA.ORBPackage.InvalidName: IDL:omg.org/CORBA/ORB/InvalidName:1.0 原因:java.lang.ClassCastException:com.sun.proxy.$Proxy67 无法转换为 org.omg.CORBA.Z497031794414A552435F90151BZAC3 - Caused by: java.lang.ClassCastException: com.sun.proxy.$Proxy67 cannot be cast to org.omg.CORBA.Object 查找中未处理的异常[根异常是org.omg.CORBA.MARSHAL: - Unhandled exception in lookup [Root exception is org.omg.CORBA.MARSHAL:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM