[jboss-user] [JBoss Seam] - Issue with instance variable not being injected/created in D

appendix do-not-reply at jboss.com
Wed Sep 6 08:44:00 EDT 2006


Hi,

I'm implementing a DecisionHandler for a workflow definition.
The class should act just as a demonstrator and is really simple. 

  | @Name("bpm.patientRegisterGoalHandler")
  | @Interceptors(SeamInterceptor.class)
  | public class PatientRegisterGoalHandler implements DecisionHandler{
  | 		
  | 	@In(value="registryData", create=true)
  | 	private RegistryData data;
  | 	
  | 	public PatientRegisterGoalHandler() {
  | 		log.debug("===== PatientenRegisterGoalHandler constructor");
  | 	}
  | 
  | 	public String decide(ExecutionContext arg0) throws Exception {
  | 		log.debug("===== PatientRegisterGoalHandler decide called");
  | 		log.debug("RegistryData: "+data);
  | 		if (data.getCountPatient()>10) return "true";
  | 		return "false";
  | 	}
  | }
  | 

Whenever the corresponding workflow instance is created, the decide methode is called, but throws an NullPointerException at the point "data" is being accessed.
My impression was that seam should instantiate the injected value, if it's null (when invoked with create=true). I added the debug logging and it shows, that the variable data is indeed null [1].

Two questions:
1) What could be the reason for seam not instantiating the variable (class RegistryData: the constructor is never called)?
2) Do I need to have the @Name and @Interceptors annotation for injection to work?

Thank you in advance,

 Kurt

[1]: the relevant part of the console output

  | 14:32:04,808 DEBUG [org.hibernate.loader.hql.QueryLoader] bindNamedParameters() registerPatients -> name [1]
  | 14:32:04,871 DEBUG [at.arcsmed.jbpm.PatientRegisterGoalHandler] ===== PatientenRegisterGoalHandler constructor
  | 14:32:04,871 DEBUG [at.arcsmed.jbpm.PatientRegisterGoalHandler] ===== PatientRegisterGoalHandler decide called
  | 14:32:04,871 DEBUG [at.arcsmed.jbpm.PatientRegisterGoalHandler] RegistryData: null
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3969730#3969730

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3969730



More information about the jboss-user mailing list