JMS - Exceptions
The JMSException
JMS defines JMSException as the root class for exceptions thrown by JMS methods. JMSException is a checked exception and catching it provides a generic way of handling all JMS related exceptions. JMSException provides the following information:
- A provider-specific string describing the error - This string is the standard Java exception message, and is available via getMessage() .
- A provider-specific string error code
- A reference to another exception - Often a JMS exception will be the result of a lower level problem. If appropriate, this lower level exception can be linked to the JMS exception.
JMS methods include only JMSException in their signatures. JMS methods can throw any JMS standard exception as well as any JMS provider-specific exception. The javadoc for JMS methods documents only the mandatory exception cases.
Standard Exceptions
In addition to JMSException, JMS defines several additional exceptions that standardize the reporting of basic error conditions. There are only a few cases where JMS mandates that a specific JMS exception must be thrown. These cases are indicated by the words must be in the exception description. These cases are the only ones on which client logic should depend on a specific problem resulting in a specific JMS exception being thrown.
In the remainder of cases, it is strongly suggested that JMS providers use one of the standard exceptions where possible. JMS providers may also derive provider-specific exceptions from these if needed.
JMS defines the following standard exceptions:
- IllegalStateException: This exception is thrown when a method is invoked at an illegal or inappropriate time or if the provider is not in an appropriate state for the requested operation. For example, this exception must be thrown if Session.commit() is called on a non-transacted session. This exception is also must be called when domain inappropriate method is called, such as calling TopicSession.CreateQueueBrowser() .
- JMSSecurityException: This exception must be thrown when a provider rejects a user name/password submitted by a client. It may also be thrown for any case where a security restriction prevents a method from completing.
- InvalidClientIDException: This exception must be thrown when a client attempts to set a connection’s client identifier to a value that is rejected by a provider.
- InvalidDestinationException: This exception must be thrown when a destination is either not understood by a provider or is no longer valid.
- InvalidSelectorException: This exception must be thrown when a JMS client attempts to give a provider a message selector with invalid syntax.
- MessageEOFException: This exception must be thrown when an unexpected end of stream has been reached when a StreamMessage or BytesMessage is being read.
MessageFormatException: This exception must be thrown when a JMS client attempts to use a data type not supported by a message or attempts to read data in a message as the wrong type. It must also be thrown when equivalent type errors are made with message property values. For example, this exception must be thrown if StreamMessage.writeObject() is given an unsupported class or if StreamMessage.readShort() is used to read a boolean value. This exception also must be thrown if a provider is given a type of
message it cannot accept. Note that the special case of a failure caused by attempting to read improperly formatted String data as numeric values must throw the java.lang.NumberFormatException.- MessageNotReadableException: This exception must be thrown when a JMS client attempts to read a write-only message.
- MessageNotWriteableException: This exception must be thrown when a JMS client attempts to write to a read-only message.
- ResourceAllocationException: This exception is thrown when a provider is unable to allocate the resources required by a method. For example, this exception should be thrown when a call to createTopicConnection fails due to lack of JMS provider resources.
- TransactionInProgressException: This exception is thrown when an operation is invalid because a transaction is in progress. For instance, attempting to call Session.commit() when a session is part of a distributed transaction should throw a TransactionInProgressException.
- TransactionRolledBackException: This exception must be thrown when a call to Session.commit results in a rollback of the current transaction.
JMS - Exceptions的更多相关文章
- Table of Contents - JMS
JMS Specification v1.1 JMS 基本概念 Message QueueBrowser 消息选择器 消息确认 ConnectionMetaData ExceptionListener ...
- JMS - ExceptionListener
If a JMS provider detects a problem with a connection, it will inform the connection’s ExceptionList ...
- jms版本
Java消息服务是一个在 Java标准化组织(JCP)内开发的标准(代号JSR 914). 2001年6月25日,Java消息服务发布JMS 1.0.2b,2002年3月18日Java消息服务发布 1 ...
- Java消息队列--JMS概述
1.什么是JMS JMS即Java消息服务(Java Message Service)应用程序接口,是一个Java平台中关于面向消息中间件(MOM)的API,用于在两个应用程序之间,或分布式系统中发送 ...
- "NHibernate.Exceptions.GenericADOException: could not load an entity" 解决方案
今天,测试一个项目的时候,抛出了这个莫名其妙的异常,然后就开始了一天的调试之旅... 花了很长时间,没有从代码找出任何问题... 那么到底哪里出问题呢? 根据下面那段长长的错误日志: -- ::, ...
- (jms)ActiveMQ 安装配置.
前言 ActiveMQ他是Apache出品的一个JMS提供者,管理会话和队列,运行在JVM下,支持多种语言,如JAVA,C++,C#,应用协议: OpenWire,Stomp REST,WS Noti ...
- 2000条你应知的WPF小姿势 基础篇<34-39 Unhandled Exceptions和Resource>
在正文开始之前需要介绍一个人:Sean Sexton. 来自明尼苏达双城的软件工程师.最为出色的是他维护了两个博客:2,000Things You Should Know About C# 和 2,0 ...
- JMS学习之路(一):整合activeMQ到SpringMVC
JMS的全称是Java Message Service,即Java消息服务.它主要用于在生产者和消费者之间进行消息传递,生产者负责产生消息,而消费者负责接收消息.把它应用到实际的业务需求中的话我们可以 ...
- activemq和jms是种什么关系
JMS是一个用于提供消息服务的技术规范,它制定了在整个消息服务提供过程中的所有数据结构和交互流程. 而activemq则是消息队列服务,是面向消息中间件(MOM)的最终实现,是真正的服务提供者. jm ...
随机推荐
- POJ 3321 Apple Tree (树状数组+dfs序)
题目链接:http://poj.org/problem?id=3321 给你n个点,n-1条边,1为根节点.给你m条操作,C操作是将x点变反(1变0,0变1),Q操作是询问x节点以及它子树的值之和.初 ...
- 数据持久化之sharedpreference的使用
要将数据持久化到手机移动设备有多种方法,其中有一种是通过sharedpreference来实现. 首先将sharedpreference初始, private SharedPreferences sp ...
- Linux实战教学笔记08:Linux 文件的属性(下半部分)
第八节 Linux 文件的属性(下半部分) 标签(空格分隔): Linux教学笔记 ---更多相关资料请点我查看 第1章 链接的概念 在linux系统中,链接可分为两种:一种为硬链接(Hard Lin ...
- mysql的interval函数用法
Name: 'INTERVAL' Description: Syntax: INTERVAL(N,N1,N2,N3,...) Returns 0 if N < N1, 1 if N < N ...
- 调用DEDE日期时间格式整理大全
dedecms 日期时间格式大全,大家可以根据需要选择.DEDECMS利用strftime()函数格式化时间的所有参数详解,包括年份日期进制.小时格式等,大家收藏吧,呵. 日期时间格式 (利用strf ...
- 《解剖PetShop》系列转载
1 <解剖PetShop>系列之六 PetShop之表示层设计 http://ityup.com/showtopic-8.html 2 <解剖PetShop>系列之五 ...
- 让sublime text 3默认新建GBK文件
想让sublime text支持显示或者保存中文,需要安装插件convertToUTF8,具体安装可以问度娘. 安装插件以后,想让保存的html文件支持中文,可以通过ctrl+shift+C来完成.但 ...
- 用C++ 自娱自乐
最无聊的时光当属 考试前的复习时段了,在一些论坛上看到一些用字符组成的图像,觉得有点意思,于是,自己 用C++ 参考一些论坛的图像,写了下面这个东西,来表达此时的心情. #include<ios ...
- CF:322D - Ciel and Duel 贪心 或者 DP 我用的贪心 。。难道sort跟qsort是不一样的么?
D. Ciel and Duel time limit per test 2 seconds memory limit per test 256 megabytes input standard in ...
- maven for eclipse在线安装
在线安装 地址变了下面的: http://download.eclipse.org/technology/m2e/releases Eclipse Indigo安装Maven插件Maven ...