activemq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Timothy Bish (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AMQ-4950) " java.lang.ClassCastException: org.apache.activemq.command.ExceptionResponse cannot be cast to org.apache.activemq.command.IntegerResponse, attempting to automatically reconnect"
Date Fri, 20 Dec 2013 16:44:09 GMT

    [ https://issues.apache.org/jira/browse/AMQ-4950?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13854137#comment-13854137
] 

Timothy Bish commented on AMQ-4950:
-----------------------------------

Possible patch, no test case at the moment to verify:

{code}
diff --git a/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java b/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
index 7ff8702..64da65a 100755
--- a/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
+++ b/activemq-client/src/main/java/org/apache/activemq/TransactionContext.java
@@ -33,6 +33,7 @@
 import org.apache.activemq.command.ConnectionId;
 import org.apache.activemq.command.DataArrayResponse;
 import org.apache.activemq.command.DataStructure;
+import org.apache.activemq.command.ExceptionResponse;
 import org.apache.activemq.command.IntegerResponse;
 import org.apache.activemq.command.LocalTransactionId;
 import org.apache.activemq.command.Response;
@@ -754,7 +765,11 @@
      */
     private Response syncSendPacketWithInterruptionHandling(Command command) throws JMSException
{
         try {
-            return this.connection.syncSendPacket(command);
+            Response result = this.connection.syncSendPacket(command);
+            if (result instanceof ExceptionResponse) {
+                throw JMSExceptionSupport.create(((ExceptionResponse) result).getException());
+            }
+            return result;
         } catch (JMSException e) {
             if (e.getLinkedException() instanceof InterruptedIOException) {
                 try {
{code}

> " java.lang.ClassCastException: org.apache.activemq.command.ExceptionResponse cannot
be cast to org.apache.activemq.command.IntegerResponse, attempting to automatically reconnect"
> -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: AMQ-4950
>                 URL: https://issues.apache.org/jira/browse/AMQ-4950
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.9.0
>            Reporter: Torsten Mielke
>            Assignee: Torsten Mielke
>              Labels: XA, prepare, transaction
>
> If an XA prepare() raises an exception back to the client it results in the warning 
> {noformat}
> WARN  FailoverTransport - Transport (tcp://127.0.0.1:61249) failed, reason:  java.io.IOException:

> Unexpected error occured: java.lang.ClassCastException: 
> org.apache.activemq.command.ExceptionResponse cannot be cast to 
> org.apache.activemq.command.IntegerResponse, attempting to automatically reconnect
> {noformat}
> which triggers a failover reconnect and a replay of the transaction which then causes
> {noformat}
> 2013-12-20 13:38:12,581 [main] - WARN  TransactionContext - prepare of: 
> XID:[86,globalId=00000001,branchId=00000001] failed with: javax.jms.JMSException: Cannot
call prepare now.
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.1.4#6159)

Mime
View raw message