Stateless component null?
ypasmk Oct 21, 2009 9:02 AMHi i have one stateless and one stateful bean ... my stateless bean is :
@Stateless
@Name("processor")
public class SchedJobAction implements SchedJob{
@Logger
private Log log;
@In QuartzTriggerHandle timer;
@Asynchronous
public void scheduleAlert(@Expiration Date when,
@IntervalDuration Long interval,
@FinalExpiration Date endDate) {
log.info("working now");
}
public void testMethod() {
log.info("test method ok");
}
}my stateful bean is
@Stateful
@Name("testJobAction")
public class testJobAction implements testJob {
@Logger
private Log log;
@In(create=true)
SchedJobAction processor;
@Remove @Destroy
public void destroy() {
// TODO Auto-generated method stub
}
public void startJob() {
// TODO Auto-generated method stub
log.info("hi there");
Calendar cal = Calendar.getInstance ();
cal.set (209, Calendar.OCTOBER, 21);
//SchedJobAction processor=new SchedJobAction();
processor.testMethod();
}
}when the startJob method is called I get the following exception
... 93 more
Caused by: java.lang.IllegalArgumentException: Could not set field value by reflection: testJobAction.processor on: panda.test.testJobAction with value: class org.javassist.tmp.java.lang.Object_$$_javassist_seam_4
at org.jboss.seam.util.Reflections.set(Reflections.java:86)
at org.jboss.seam.Component.setFieldValue(Component.java:1923)
... 121 more
Caused by: java.lang.IllegalArgumentException
at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
at java.lang.reflect.Field.set(Field.java:657)
at org.jboss.seam.util.Reflections.set(Reflections.java:71)
... 122 more
09:58:14,362 WARN [lifecycle] #{testJobAction.startJob}: javax.ejb.EJBTransactionRolledbackException: could not set field value: testJobAction.processor
javax.faces.FacesException: #{testJobAction.startJob}: javax.ejb.EJBTransactionRolledbackException: could not set field value: testJobAction.processor
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at javax.faces.component.UICommand.broadcast(UICommand.java:387)
at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:321)
at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:296)
at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:253)
If I remove the
@In SchedJobAction processor
and just insert
SchedJobAction processor=new SchedJobAction()
then when the processor.testMethod() is called, the timer and log are both null...what am I doing wrong?