Corba JAVA异常

Corba异常和Java异常的区别
在IDL的接口设计中可以使用raises关键字定义用户级的异常,而标准的系统异常无需也无法在IDL里面定义。
To specify an exception in IDL, the interface designer uses the raises keyword. This is similar to the throws specification in Java. When you use the exception keyword in IDL you create a user-defined exception. The standard system exceptions need not (and cannot) be specified this way.

Corba系统异常
1. 服务端的系统异常,比如资源耗尽、服务不存在;
2. 通讯的系统异常,比如和服务对象失去联系、服务器未启动、无法和ORB进程通讯;
3. 客户端的系统异常,比如一个输入一个不类型匹配的参数;
任何的IDL接口操作都可能产生以上异常,这种异常无需在接口中定义。在JAVA程序中,这些异常都被定为RuntimeException,所以调用这些接口的代码必须考虑这些异常,也就是说必须去catch这些异常。

exception <SystemExceptionName> { // descriptive of error
unsigned long minor; // more detail about error
CompletionStatus completed; // yes, no, maybe
}
java.lang.Exception
|
+--java.lang.RuntimeException
|
+--org.omg.CORBA.SystemException
|
+--BAD_PARAM
|
+--//etc.

Minor Codes:所有的Corba异常都有一个minor代码,这个代码代表了异常的更详细的信息。minor代码并不是由OMG定义,而是由各个ORB提供商定义。
Completion Status:所有的Corba异常都有一个完成状态代码,这个状态代表了抛出异常的接口的执行完成状态。完成代码如下:
COMPLETED_YES:接口操作在异常抛出前已经执行完成;
COMPLETED_NO:在异常抛出前接口操作并未执行;
COMPLETED_MAYBE:操作是否执行未知。

用户级异常
在IDL接口中定义的用户级异常都会在JAVA代码中产生一个必须处理的JAVA异常。
java.lang.Exception
|
+--org.omg.CORBA.UserException
|
+-- Stocks.BadSymbol
|
+--//etc.

附录
OpenORB Minor Codes
http://openorb.sourceforge.net/docs/1.3.0/OpenORB/doc/orb.html#N105EF
The following list provides the explanation of OpenORB minor error codes for CORBA System exceptions:
1146056705 : Attempt to access incomplete typecode containing recursive
1146056706 : Invocation order when using DSI
1146056707 : Invocation order when using streaming stubs (Delegate)
1146056708 : ORB is not initialized
1146056709 : Server invocation order
1146056710 : Attempt to extract wrong type from Any
1146056711 : Object class cannot be instantiated or is incorrect type
1146056712 : Type mismatch in list streams with fixed type
1146056713 : Object class cannot be instantiated or is incorrect type
1146056714 : Attempt to insert value into Any with incorrect typecode
1146056715 : Array index out of bounds
1146056716 : Object class cannot be instantiated or is incorrect type
1146056717 : No primitive typecode of that kind
1146056718 : Object class cannot be instantiated or is incorrect type
1146056719 : Unable to find interface repository
1146056720 : Unable to find interface in interface repository
1146056721 : Unable interface from repository is the wrong type
1146056722 : Sequence length exceeds limit in typecode
1146056723 : Attempt to overread input stream
1146056724 : Type mismatch for list stream
1146056725 : Bounds mismatch for list stream
1146056726 : Buffer overread
1146056727 : Buffer underread
1146056728 : Invalid buffer position or format.
1146056729 : Attempt to insert native type into Any
1146056730 : Problem with union discriminator
1146056731 : Unable to extract valuebox type from Any, missing helper
1146056961 : IIOP version does not support primitive
1146056962 : Object class cannot be instantiated or is incorrect type
1146056961 : Typecode is not fixed typecode
1146056963 : Object class cannot be instantiated or is incorrect type
1146056964 : Null valued strings cannot be transmitted
1146056965 : Array index out of bounds
1146056966 : Object class cannot be instantiated or is incorrect type
1146056967 : Connection to client has been lost before reply can be sent
1146056968 : No route to server
1146056969 : No connection to server, server is not listening or connection refused
1146056970 : Unable to find host in DNS
1146056971 : Invalid tag for IIOP profile
1146056972 : IIOP profile data is corrupted
1146056973 : Component data is corrupted
1146056974 : Component data is corrupted
1146056975 : Problem with marshalling / unmarshalling char data
1146056976 : Problem with marshalling / unmarshalling wchar data
1146056977 : Recursive typecode offset does not match Any known typecode
1146056978 : Typecode kind unknown
1146056979 : Problem with fixed type
1146056980 : Problem with valuetype encoding
1146056981 : Failed to close encapsulation layer before calling close operation
1146056982 : Problem with valuetype encoding
The following list provides the OMG error codes for the CORBA System Exceptions.
UNKNOWN
1 : Unlisted user exception received by client
2 : Non-standard System Exception not supported
BAD_PARAM
1 : Failure to register, unregister, or lookup value factory
2 : RID already defined in IFR
3 : Name already used in the context in IFR
4 : Target is not a valid container
5 : Name clash in inherited context
6 : Incorrect type for abstract interface
7 : string_to_object conversion failed due to bad scheme name
8 : string_to_object conversion failed due to bad address
9 : string_to_object conversion failed due to bad schema specific part
10 : string_to_object conversion failed due to non-specific reason
11 : Attempt to derive abstract interface from non-abstract base interface in the Interface Repository
12 : Non-abstract interface in the Interface Repository
13 : Attempt to use an incomplete TypeCode as a parameter
14 : Invalid object id passed to POA::create_reference_by_id
15 : Bad name argument in TypeCode operation
16 : Bad RepositoryId argument in TypeCode operation
17 : Invalid member name in TypeCode operation
18 : Duplicate label value in create_union_tc
19 : Incompatible TypeCode of label and discriminator in create_union_tc
20 : Supplied discriminator type illegitimate in create_union_tc
21 : Any passed to ServerRequest::set_exception does not contain an exception
22 : Unlisted user exception passed to ServerRequest::set_exception
23 : wchar transmission code set not in service context
24 : Service context is not in OMG-defined range
25 : Enum value out of range
IMP_LIMIT
1 : Unable to use Any profile in IOR
INV_OBJREF
1 : wchar Code Set support not specified
MARSHAL
1 : Unable to locate value factory
2 : ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause
3 : NVList passed to ServerRequest::arguments does not describe all parameters passed by client
4 : Attempt to marshal Local object
BAD_TYPECODE
1 : Attempt to marshal incomplete TypeCode
2 : Member type code illegitimate in TypeCode operation
NO_IMPLEMENT
1 : Missing local value implementation
2 : Incompatible value implementation version
3 : Unable to use any profile in IOR
4 : Attempt to use DII on Local object
BAD_INV_ORDER
1 : Dependency exists in IFR preventing destruction of this object
2 : Attempt to destroy indestructible objects in IFR
3 : Operation would deadlock
4 : ORB has shutdown
5 : Attempt to invoke send or invoke operation of the same Request object more than once
6 : Attempt to set a servant manager after one has already been set
7 : ServerRequest::arguments called more than once or after a call to ServerRequest:: set_exception
8 : ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception
9 : ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception
10 : Attempt to send a DII request after it was sent previously
11 : Attempt to poll a DII request or to retrieve its result before the request was sent
12 : Attempt to poll a DII request or to retrieve its result after the result was retrieved previously
13 : Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request
TRANSIENT
1 : Request discarded due to resource exhaustion in POA
2 : No usable profile in IOR
OBJ_ADAPTER
1 : System exception in POA::unknown_adapter
2 : Servant not found [ServantManager]
3 : No default servant available [POA policy]
4 : No servant manager available [POA Policy]
5 : Violation of POA policy by ServantActivator::incarnate
DATA_CONVERSION
1 : Character does not map to negotiated transmission code set
OBJECT_NOT_EXIST
1 : Attempt to pass an unactivated (unregistered) value as an object reference
2 : POAManager::incarnate failed to create POA
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值