QueueSession is null when injected in classes with methods annotated as @Asynchronous
-------------------------------------------------------------------------------------
Key: JBSEAM-2683
URL:
http://jira.jboss.com/jira/browse/JBSEAM-2683
Project: JBoss Seam
Issue Type: Bug
Components: Async
Affects Versions: 2.0.0.GA
Environment: win xp, jboss 4.2.2, Java(TM) 2 Runtime Environment, Standard
Edition (build 1.5.0_13-b05-241)
Reporter: Vassilis Petropoulos
a) components.xml
<jms:managed-queue-sender name="processSMSQueueSender"
auto-create="true" queue-jndi-name="queue/processSMS" />
b) SmsHandlerBean.java
@Stateless
@Name("smsHandler")
public class SmsHandlerBean implements SmsHandler {
@In(create=true) SMSScheduler smsScheduler;
public void test(Sms sms) throws Exception {
QuartzTriggerHandle quartzTriggerHandle = smsScheduler.schedule(
sms.getId(), sms.getStartDate(), sms.getEndDate(), sms.getCronExpression());
}
}
c) SMSScheduler.java
@Name("smsScheduler")
public class SMSScheduler {
@In QueueSender processSMSQueueSender;
@In QueueSession queueSession;
@Asynchronous
@Transactional
public QuartzTriggerHandle schedule(int smsId, @Expiration Date when, @FinalExpiration
Date endDate, @IntervalCron String cron) {
try {
processSMSQueueSender.send(queueSession.createObjectMessage(smsId));
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
}
when scheduler fires queueSession, processSMSQueueSender are null. This also happens if
use create=true.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira