Seam 2.3 migration - lookup of Session Beans from asynchronous call
larshe Oct 18, 2012 1:49 PMI am having a problem with jndi lookups of Session Beans from asynchronous calls ( via Component.getInstance(...) ) in Seam 2.3. Lookup of POJO components is working fine. The calls are initiated by the quartz scheduler declared as:
<async:quartz-dispatcher/>. <event type="org.jboss.seam.postInitialization"> <action execute="#{quartzController.scheduleTimer}"/> </event>
As per the migration guide in the Seam 2.3 documentation I have changed the lookup pattern in web.xml to :
<core:init jndi-pattern="java:app/aubama-ejb/#{ejbName}"/>
<component class="org.jboss.seam.transaction.EjbSynchronizations" jndi-name="java:app/jboss-seam/EjbSynchronizations"/>
Example:
Name("garpSyncWrapper")public class GarpSyncWrapper { @Asynchronous public void synchronize(@IntervalCron String cronString) { syncSuppliers(); } public void syncSuppliers() { // Lookup of a SLSB SupplierSynchronizer supplierSynchronizer = (SupplierSynchronizer) Component.getInstance("supplierSynchronizer"); ... } }
The supplierSynchronizer lookup above fails when asynchronously called via synchronize(...) method above. If called synchronously from the web-gui the lookup succeeds. The cause of the failure when called asynchronously is:
----------------------------
Exception thrown whilst executing asynchronous call: org.jboss.seam.InstantiationException: Could not instantiate Seam component: supplierSynchronizer
...
Caused by: javax.naming.NameNotFoundException: java:app/aubama-ejb/SupplierSynchronizerBean
----------------------------
Lookup also fails when Seam initiates an asynchronous lookup of EjbSynchronizations which I think is a stateful session bean (Same here, no lookup error when called synchronously). Exception:
----------------------------
Exception thrown whilst executing asynchronous call: org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.transaction.synchronizations
...
Caused by: javax.naming.NameNotFoundException: java:app/jboss-seam/EjbSynchronizations
-----------------------------
This code worked fine in Seam 2.2. Any ideas what I might be doing wrong or if this is a bug of some kind?
Thanks.