You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an application exception is thrown from a message driven bean method, the EJB container throws an unexpected exception that swallows the original one.
Expected Outcome
The EJB container should obviously not throw any internal exception :)
Current Outcome
I have the following bean which always throws an exception (I'm using Payara Kafka RA):
The following message is logged when a message is received:
[2018-11-11T20:58:48.858+0100] [] [GRAVE] [] [fish.payara.cloud.connectors.kafka.inbound.KafkaResourceAdapter] [tid: _ThreadID=130 _ThreadName=orb-thread-pool-1 (pool #1): worker-1] [timeMillis: 1541966328858] [levelValue: 1000] [[
java.lang.reflect.InvocationTargetException
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 fish.payara.cloud.connectors.kafka.inbound.KafkaWork.run(KafkaWork.java:103)
at com.sun.enterprise.connectors.work.OneWork.doWork(OneWork.java:107)
at com.sun.corba.ee.impl.threadpool.ThreadPoolImpl$TaskRunner.run(ThreadPoolImpl.java:189)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: javax.ejb.EJBException: Transaction Attribute not found for methodpublic abstract void eu.ggam.kafkatest.__EJB32_Generated__TestResource__Intf__.onRecord(org.apache.kafka.clients.consumer.ConsumerRecord)
at com.sun.ejb.containers.BaseContainer.getTxAttr(BaseContainer.java:2871)
at org.glassfish.ejb.mdb.MessageBeanContainer.containerStartsTx(MessageBeanContainer.java:399)
at org.glassfish.ejb.mdb.MessageBeanContainer.isDeliveryTransacted(MessageBeanContainer.java:713)
at com.sun.enterprise.connectors.inbound.MessageEndpointInvocationHandler.invoke(MessageEndpointInvocationHandler.java:173)
at com.sun.proxy.$Proxy288.onRecord(Unknown Source)
at eu.ggam.kafkatest.__EJB32_Generated__TestResource__Intf____Bean__.onRecord(Unknown Source)
... 12 more
]]
Description
When an application exception is thrown from a message driven bean method, the EJB container throws an unexpected exception that swallows the original one.
Expected Outcome
The EJB container should obviously not throw any internal exception :)
Current Outcome
I have the following bean which always throws an exception (I'm using Payara Kafka RA):
The following message is logged when a message is received:
Debugging the source I found that BaseContainer is invoked with the EJB view method while the invocationInfo map only contains the methods for the original class:
https://github.com/payara/Payara/blob/payara-server-5.183/appserver/ejb/ejb-container/src/main/java/com/sun/ejb/containers/BaseContainer.java#L2866
The problem seems to come from the MessageBeanContainer class, which creates that EJB view in case the listener interface has no methods:
https://github.com/payara/Payara/blob/payara-server-5.183/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/mdb/MessageBeanContainer.java#L178
But then only adds the original class methods to the invocation map:
https://github.com/payara/Payara/blob/payara-server-5.183/appserver/ejb/ejb-full-container/src/main/java/org/glassfish/ejb/mdb/MessageBeanContainer.java#L190
Environment
The text was updated successfully, but these errors were encountered: