Bug 904174

Summary: Issue with TCCL which is causing the Quartz thread to not have access to the application's "java:app" context
Product: [JBoss] JBoss Enterprise Application Platform 6 Reporter: Luan Cestari <lcestari>
Component: Seam2Assignee: Marek Novotny <mnovotny>
Status: CLOSED WONTFIX QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.0.1CC: istudens, maschmid, mnovotny, myarboro, nraghava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-03-19 11:05:38 UTC 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:
Attachments:
Description Flags
An example of Source (it isn't the same version of attached EAR, but it is almost identical) none

Description Luan Cestari 2013-01-25 16:36:36 UTC
Description of problem:
Issue with TCCL which is causing the Quartz thread to not have access to the application's "java:app" context. In other words, Seam can`t find the beans in context, even that they are there (due the annotations and logs that confirm that).

EAP 6`s documentation that gives the steps to migrate Seam 2 applications: https://access.redhat.com/knowledge/docs/en-US/JBoss_Enterprise_Application_Platform/6/html-single/Migration_Guide/index.html#sect-Migrate_Seam_2.2_Applications



Version-Release number of selected component (if applicable):

Seam 2.2 in EAP 6



How reproducible:
Just create a Seam and Quartz bean and another Seam and EJB bean that on Startup will lookup for Seam/Quartz bean, but can`t find it.



Actual results:
Can`t find the bean



Expected results:
Find the bean



Additional info:
salesforce link: https://c.na7.visual.force.com/apex/Case_View?id=500A000000CQzrg&sfdc.override=1

Comment 8 Marek Novotny 2013-04-16 09:59:54 UTC
Have you tried to use global JNDI instead?

Comment 9 Luan Cestari 2013-04-22 12:23:15 UTC
Hi Marek,

In InitilizeTimers class he used Seam API to find or create the timers ( Component.getInstance(nme, true, true)). About using the JNDI, I remember that we tried but it didn`t work as well. I Also talked with a guy from SEG that confirmed about TCCL.

Regards,
Luan

Comment 11 Luan Cestari 2013-05-06 12:33:23 UTC
Created attachment 744106 [details]
An example of Source (it isn't the same version of attached EAR, but it is almost identical)

Comment 18 JBoss JIRA Server 2013-09-24 12:04:22 UTC
Marek Novotny <mnovotny> updated the status of jira JBSEAM-5072 to Closed

Comment 19 JBoss JIRA Server 2013-09-24 12:04:22 UTC
Marek Novotny <mnovotny> made a comment on jira JBSEAM-5072

Basically before JBoss AS7 existance all JBoss servers (4,5,6) had a quartz Resource adapter which introduced and set up the correct EJB initial context. So Seam 2 pojo component worked. JBoss AS7 implements Java EE 6 and it enhanced TimerService features so AS team didn't invest any time to resource adapter for another timer scheduler/service as is Quartz. Every non-ejb thread needs to use java:global JNDI or create scheduler thread(s) from EJB component, recommended is EJB Singleton.

Comment 20 JBoss JIRA Server 2013-09-26 12:25:39 UTC
Claus Elsborg <claus.elsborg> made a comment on jira JBSEAM-5072

It looks like java:global JNDI is not available until the application is fully deployed. 
This means that quartz jobs that fires during startup throws a javax.naming.NameNotFoundException: appname/jboss-seam/EjbSynchronizations -- service jboss.naming.context.java.global.appname.jboss-seam.EjbSynchronizations.
If Quartz jobs are persisted in a database, the quartz jobs gets scheduled during the QuartzDispatcher.java Startup. 
If using RAM store, it is normal to schedule the jobs by observing the org.jboss.seam.postInitialization event. But even here it still fails. After deployment is complete the jobs works fine.

For the described workaround to be useful I need a way to schedule quartz jobs during deployment or a least just after deployment completes in order to handle "misfires" during server down time. Any ideas of how to do this?

Comment 22 Ivo Studensky 2015-03-19 11:05:38 UTC
The upstream issue has been closed as Won'tFix.