Bug 1098127

Summary: [GSS] (6.4) "Failure while notifying an observer of event" in CDI transactional observer methods with remote EJB call using JTS
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Matous Jobanek <mjobanek>
Component: CDI/Weld, Transaction ManagerAssignee: Amos Feng <zfeng>
Status: CLOSED CURRENTRELEASE QA Contact: Matous Jobanek <mjobanek>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.3.0CC: bbaranow, hhovsepy, kkhan, mkouba, ochaloup, tom.jenkinson, zfeng
Target Milestone: DR13   
Target Release: EAP 6.4.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
In previous versions of JBoss EAP 6, firing a CDI event from a remote EJB client using JTS transactions resulted in a failure in invocation of transactional observers on the server. This was fixed by correcting the JNDI namespace selection for transaction synchronization callbacks in the Weld integration code. Transactional observers are now properly invoked in distributed transaction scenarios.
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1167917    
Bug Blocks:    
Attachments:
Description Flags
reproducer
none
server log 1
none
server log 2 none

Description Matous Jobanek 2014-05-15 11:10:25 UTC
Consider following scenario:
I've got two EAP instances:
EAP1
EAP2

On EAP2 there is remote EJB "InvoiceManagerEJBHome" which has one method "fireInvoiceEvent" which fires an CDI event "InvoiceEvent"
On EAP2 there are also transactional observers methods for all transaction phases which receive event notifications during, before or after completion phase of the transaction in which the event "InvoiceEvent" was fired.

On EAP1 the remote EJB is injected (with the aid of JNDI lookup) and the method "fireInvoiceEvent" is called in container managed transaction.

JTS is used for transaction and servers are properly configured.

Expected result:
The transactional observer methods should be invoked.

Actual results:
Only one transactional observer method is invoked - for the phase IN_PROGRESS, for the rest of the phases there will appear this ERROR message in the server log of EAP2:
11:47:01,034 ERROR [org.jboss.weld.Event] (RequestProcessor-14) WELD-000401 Failure while notifying an observer of event org.jboss.as.quickstarts.cmt.jts.ejb.InvoiceEvent@564d9b1f


How reproducible:
I attached a reproducer example - it is a modified "jts" EAP quickstart


Steps to Reproduce:
1. Download the reproducer example and unzip it
2. follow the parts "Configure the JBoss Servers", "Start the JBoss servers" and "Build and Deploy the Quickstart" of the jts EAP quickstart:
http://www.jboss.org/jdf/quickstarts/jboss-as-quickstart/jts/
(no Postgres configuration is needed)
3. open the page http://127.0.0.1:8080/jboss-jts-application-component-1
4. click on the button "fire"
5. look at the server log

Comment 1 Matous Jobanek 2014-05-15 11:11:12 UTC
Created attachment 895842 [details]
reproducer

Comment 2 Matous Jobanek 2014-06-17 15:12:43 UTC
Created attachment 909631 [details]
server log 1

Comment 3 Matous Jobanek 2014-06-17 15:13:10 UTC
Created attachment 909632 [details]
server log 2

Comment 4 Matous Jobanek 2014-06-17 15:13:29 UTC
added the whole server logs - the failure is on the bottom

Comment 6 Amos Feng 2014-12-08 06:40:58 UTC
I think this issue should be resolved with upgrading the jbossts to 4.17.25.Final with fixing JBTM-2272.

It would be useful to backport the fix of NameNotFound Exception in the upstream WFLY-3548 PR
https://github.com/wildfly/wildfly/pull/6988 although it looks like related to the iiop thread problems. It happens if the Observer class injects the UserTransaction by JNDI "java:comp/UserTransaction"

Tom, feel free to assign the BZ to me if you think it makes sense.

Comment 7 tom.jenkinson 2014-12-08 10:11:00 UTC
Thanks Amos - much appreciated. I am going to add the Transaction Manager component to this too as I had completed missed it.

Comment 9 Matous Jobanek 2014-12-12 14:54:47 UTC
Verified in EAP 6.4.0.DR13