You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Jonathan S Fisher (JIRA)" <ji...@apache.org> on 2017/01/25 19:03:26 UTC
[jira] [Resolved] (TOMEE-2004) Receive an AbstractMethodError when
calling message.getBody(String.class) in an Arquillian test
[ https://issues.apache.org/jira/browse/TOMEE-2004?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jonathan S Fisher resolved TOMEE-2004.
--------------------------------------
Resolution: Not A Problem
> Receive an AbstractMethodError when calling message.getBody(String.class) in an Arquillian test
> -----------------------------------------------------------------------------------------------
>
> Key: TOMEE-2004
> URL: https://issues.apache.org/jira/browse/TOMEE-2004
> Project: TomEE
> Issue Type: Bug
> Reporter: Jonathan S Fisher
> Priority: Minor
>
> Given this message listener:
> {code}
> @MessageDriven(activationConfig = {
> @ActivationConfigProperty(propertyName = "destination", propertyValue = "org.apache.tomee.test"),
> @ActivationConfigProperty(propertyName = "maxSessions", propertyValue = "1"), })
> public class TestMessageListener implements MessageListener {
> public static final List<String> strings = Collections
> .synchronizedList(new LinkedList<>());
> @Override
> public void onMessage(Message message) {
> try {
> String payload = message.getBody(String.class);
> System.out.println(payload);
> strings.add(payload);
> } catch (JMSException e) {
> throw new RuntimeException(e);
> }
> }
> }
> {code}
> And this test:
> {code}
> @RunWith(Arquillian.class)
> public class TestMessageListenerTest {
> @Deployment
> public static Archive<?> createTestArchive() {
> return ShrinkWrap.create(WebArchive.class)
> .addPackage(TestMessageListener.class.getPackage());
> }
> @Test
> public void testSendMessage(JMSContext jmsContext) throws Exception {
> String destinationName = "org.apache.tomee.test";
> Destination destination = jmsContext.createQueue(destinationName);
> jmsContext.createProducer().send(destination, "test message");
> Thread.sleep(1000L);
> assertTrue(TestMessageListener.strings.size() > 1);
> }
> }
> {code}
> You will get this stack trace. Oddly enough this works if you deploy it to an actual server. The workaround is to cast the {{message}} to a {{TextMessage}} and then call {{textMessage.getText()}} This happens in both managed and remote
> {quote}
> INFO: Successfully established connection to broker [vm://jvm_broker]
> Jan 25, 2017 12:22:49 PM org.apache.geronimo.connector.work.WorkerContext run
> INFO: Removing non-required WorkContextHandler with no context: org.apache.geronimo.connector.work.TransactionContextHandler@1e218814
> Jan 25, 2017 12:22:49 PM org.apache.geronimo.connector.work.WorkerContext run
> INFO: Removing non-required WorkContextHandler with no context: org.apache.openejb.core.security.SecurityContextHandler@10e665a0
> Jan 25, 2017 12:22:49 PM org.apache.geronimo.connector.work.WorkerContext run
> INFO: Removing non-required WorkContextHandler with no context: org.apache.geronimo.connector.work.HintsContextHandler@14d9e364
> Jan 25, 2017 12:22:49 PM org.apache.openejb.core.transaction.EjbTransactionUtil handleSystemException
> SEVERE: EjbTransactionUtil.handleSystemException: org.apache.activemq.command.ActiveMQTextMessage.getBody(Ljava/lang/Class;)Ljava/lang/Object;
> java.lang.AbstractMethodError: org.apache.activemq.command.ActiveMQTextMessage.getBody(Ljava/lang/Class;)Ljava/lang/Object;
> at com.tomitribe.training.jms.TestMessageListener.onMessage(TestMessageListener.java:23)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
> at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
> at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> at org.apache.openejb.core.mdb.MdbContainer._invoke(MdbContainer.java:409)
> at org.apache.openejb.core.mdb.MdbContainer.invoke(MdbContainer.java:383)
> at org.apache.openejb.core.mdb.EndpointHandler.deliverMessage(EndpointHandler.java:228)
> at org.apache.openejb.core.mdb.EndpointHandler.invoke(EndpointHandler.java:169)
> at com.tomitribe.training.jms.TestMessageListener$$LocalBeanProxy.onMessage(com/tomitribe/training/jms/TestMessageListener.java)
> at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:123)
> at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:64)
> at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:1041)
> at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:169)
> at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:366)
> at org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> java.rmi.RemoteException: The bean encountered a non-application exception; nested exception is:
> java.lang.AbstractMethodError: org.apache.activemq.command.ActiveMQTextMessage.getBody(Ljava/lang/Class;)Ljava/lang/Object;
> at org.apache.openejb.core.transaction.EjbTransactionUtil.handleSystemException(EjbTransactionUtil.java:155)
> at org.apache.openejb.core.mdb.MdbContainer._invoke(MdbContainer.java:427)
> at org.apache.openejb.core.mdb.MdbContainer.invoke(MdbContainer.java:383)
> at org.apache.openejb.core.mdb.EndpointHandler.deliverMessage(EndpointHandler.java:228)
> at org.apache.openejb.core.mdb.EndpointHandler.invoke(EndpointHandler.java:169)
> at com.tomitribe.training.jms.TestMessageListener$$LocalBeanProxy.onMessage(com/tomitribe/training/jms/TestMessageListener.java)
> at org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointAlive.onMessage(MessageEndpointProxy.java:123)
> at org.apache.activemq.ra.MessageEndpointProxy.onMessage(MessageEndpointProxy.java:64)
> at org.apache.activemq.ActiveMQSession.run(ActiveMQSession.java:1041)
> at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:169)
> at org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:366)
> at org.apache.geronimo.connector.work.pool.NamedRunnable.run(NamedRunnable.java:32)
> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> at java.lang.Thread.run(Thread.java:745)
> Caused by: java.lang.AbstractMethodError: org.apache.activemq.command.ActiveMQTextMessage.getBody(Ljava/lang/Class;)Ljava/lang/Object;
> at com.tomitribe.training.jms.TestMessageListener.onMessage(TestMessageListener.java:23)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
> at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:181)
> at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:100)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:498)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
> at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
> at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
> at org.apache.openejb.core.mdb.MdbContainer._invoke(MdbContainer.java:409)
> ... 13 more
> {quote}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)