You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Kevan Miller (JIRA)" <ji...@apache.org> on 2007/02/15 17:16:05 UTC

[jira] Commented: (AMQ-1088) TransactionContext class cast exception

    [ https://issues.apache.org/activemq/browse/AMQ-1088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_38529 ] 

Kevan Miller commented on AMQ-1088:
-----------------------------------

I've seen this problem on 4.1.0. Don't care for the above patch, as it can result in an NPE on 4.1.0 (if length is 0, return a zero length array, not null), but certainly agree with the sentiment...

I'm not sure where the type information is being lost. The data type in the broker is XATransactionId[]. But the type in client is DataStructure[]. In my case, the length of the array is zero -- not sure if that's significant...

Here's my stack trace:

java.lang.ClassCastException: [Lorg.apache.activemq.command.DataStructure;
	at org.apache.activemq.TransactionContext.recover(TransactionContext.java:517)
	at org.apache.activemq.ra.LocalAndXATransaction.recover(LocalAndXATransaction.java:123)
	at org.apache.geronimo.transaction.manager.WrapperNamedXAResource.recover(WrapperNamedXAResource.java:74)
	at org.apache.geronimo.connector.outbound.ConnectionManagerContainer$ReturnableXAResource.recover(ConnectionManagerContainer.java:89)
	at org.apache.geronimo.transaction.manager.RecoveryImpl.recoverResourceManager(RecoveryImpl.java:95)
	at org.apache.geronimo.transaction.manager.TransactionManagerImpl.recoverResourceManager(TransactionManagerImpl.java:361)
	at org.apache.geronimo.transaction.jta11.GeronimoTransactionManagerJTA11GBean.access$000(GeronimoTransactionManagerJTA11GBean.java:42)
	at org.apache.geronimo.transaction.jta11.GeronimoTransactionManagerJTA11GBean$1.memberAdded(GeronimoTransactionManagerJTA11GBean.java:68)
	at org.apache.geronimo.gbean.runtime.ProxyCollection.addTarget(ProxyCollection.java:102)
	at org.apache.geronimo.gbean.runtime.GBeanCollectionReference.targetAdded(GBeanCollectionReference.java:96)
	at org.apache.geronimo.gbean.runtime.GBeanCollectionReference.addTarget(GBeanCollectionReference.java:180)
	at org.apache.geronimo.gbean.runtime.GBeanCollectionReference$1.running(GBeanCollectionReference.java:110)
	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:173)
	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:41)
	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:251)
	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:292)
	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
	at org.apache.geronimo.gbean.runtime.GBeanInstance.start(GBeanInstance.java:529)
	at org.apache.geronimo.gbean.runtime.GBeanDependency.attemptFullStart(GBeanDependency.java:111)
	at org.apache.geronimo.gbean.runtime.GBeanDependency.addTarget(GBeanDependency.java:146)
	at org.apache.geronimo.gbean.runtime.GBeanDependency$1.running(GBeanDependency.java:120)
	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.fireRunningEvent(BasicLifecycleMonitor.java:173)
	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor.access$300(BasicLifecycleMonitor.java:41)
	at org.apache.geronimo.kernel.basic.BasicLifecycleMonitor$RawLifecycleBroadcaster.fireRunningEvent(BasicLifecycleMonitor.java:251)
	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.attemptFullStart(GBeanInstanceState.java:292)
	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.start(GBeanInstanceState.java:102)
	at org.apache.geronimo.gbean.runtime.GBeanInstanceState.startRecursive(GBeanInstanceState.java:124)
	at org.apache.geronimo.gbean.runtime.GBeanInstance.startRecursive(GBeanInstance.java:543)
	at org.apache.geronimo.kernel.basic.BasicKernel.startRecursiveGBean(BasicKernel.java:379)
	at org.apache.geronimo.kernel.config.ConfigurationUtil.startConfigurationGBeans(ConfigurationUtil.java:378)
	at org.apache.geronimo.kernel.config.KernelConfigurationManager.start(KernelConfigurationManager.java:188)
	at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:527)
	at org.apache.geronimo.kernel.config.SimpleConfigurationManager.startConfiguration(SimpleConfigurationManager.java:508)
	at org.apache.geronimo.kernel.config.SimpleConfigurationManager$$FastClassByCGLIB$$ce77a924.invoke(<generated>)
	at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
	at org.apache.geronimo.gbean.runtime.FastMethodInvoker.invoke(FastMethodInvoker.java:38)
	at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:127)
	at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:820)
	at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
	at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
	at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
	at org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$9878a9ef.startConfiguration(<generated>)
	at org.apache.geronimo.system.main.Daemon.doStartup(Daemon.java:286)
	at org.apache.geronimo.system.main.Daemon.<init>(Daemon.java:74)
	at org.apache.geronimo.system.main.Daemon.main(Daemon.java:366)


> TransactionContext class cast exception
> ---------------------------------------
>
>                 Key: AMQ-1088
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1088
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Connector
>    Affects Versions: 4.0.1
>         Environment: XP - jre 1.4
>            Reporter: Mary Nicholas
>            Priority: Minor
>
> The class org.apache.activemq.TransactionContext throws a class cast exception on the recover(int flag) method on the line (or at least it does with jdk1.4) return (XATransactionId[]) receipt.getData();
>  
> It cannot cast the list of DataStructure[] to XATransactionId[]. I just unpacked it locally as a fix (as seen below) and it worked fine. Have not checked it in though in case others with more experience on this one disagree.
> DataStructure[] x = receipt.getData(); 
>  
> if (x.length > 0)
> {
>       XATransactionId xaId[] = new XATransactionId[x.length];
>       int count = 0;
>       for (count =0; count < x.length; count++)
>                     xaId[count] = (XATransactionId)x[count]; 
>                     
>       return xaId;
> }
> else
>       return null;

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.