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

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

Looks like the offending code is here in TransactionContext 

{code}
            // Find out if the server wants to commit or rollback.
            IntegerResponse response = 
(IntegerResponse)syncSendPacketWithInterruptionHandling(info);
            if (XAResource.XA_RDONLY == response.getResult()) {
                // transaction stops now, may be syncs that need a callback
                        synchronized(ENDED_XA_TRANSACTION_CONTEXTS) {
                        List<TransactionContext> l = 
ENDED_XA_TRANSACTION_CONTEXTS.remove(x);
                        if (l != null && !l.isEmpty()) {
                            if (LOG.isDebugEnabled()) {
                                LOG.debug("firing afterCommit callbacks on 
XA_RDONLY from prepare: " + xid);
                            }
                            for (TransactionContext ctx : l) {
                                ctx.afterCommit();
                            }
                        }
                        }
            }
{code}

We blindly cast to IntegerResponse before checking for error. 

> " 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)

Reply via email to