[jboss-user] [JBoss Seam] - Re: Message Driven Bean starting jbpm process

jgeraert do-not-reply at jboss.com
Fri Oct 5 04:34:01 EDT 2007


Hello,


I had already tried with the TransactionAttribute removed. I looked closer to the NullPointerException in the stacktrace


  | Caused by: java.lang.NullPointerException
  | 	at org.jboss.seam.contexts.BusinessProcessContext.getNamesFromContext(BusinessProcessContext.java:1
  | 15)
  | 


I took a dive in this Seam code: 


  | 
  |    private Set<String> getNamesFromContext()
  |    {
  |       //TODO: note that this is called from Contexts.destroy(),
  |       //      after the Seam-managed txn was committed, but
  |       //      this implementation requires a hit to the database!
  |       HashSet<String> results = new HashSet<String>();
  |       org.jbpm.taskmgmt.exe.TaskInstance taskInstance = getTaskInstance();
  |       if (taskInstance==null)
  |       {
  |          ContextInstance context = getContextInstance();
  |          if ( context!=null )
  |          {
  |             results.addAll( context.getVariables().keySet() );
  |          }
  |       }
  |       else
  |       {
  |          results.addAll( taskInstance.getVariables().keySet() );
  |       }
  |       return results;
  |    }
  | 
  | 

Apperantly context.getVariables() is null obviously causing the NullpointerException.  
I tried to quickfix this with

  | 
  | if ( context!=null && context.getVariables() !=null )
  |          {
  |             results.addAll( context.getVariables().keySet() );
  |          }
  | 
  | 

I don't know if it is a correct fix but this seemed to work for me. 

Another thing that fixes the thing is actually Outjecting a variable to the business context. 


  | 
  | @Stateless
  | @Name("inklessProcessManager")
  | @Interceptors(SeamInterceptor.class)
  | public class InklessProcessManagerImpl implements InklessProcessManager {
  | 
  | 	@Out(scope=ScopeType.BUSINESS_PROCESS, value="foo") Integer someThing;
  | 
  | 	@CreateProcess(definition="inkless")
  | 	public void startProcess() {
  | 		someThing=new Integer(5);
  | 	}
  | 
  | }
  | 
  | 


So i presume this is an bug. Shall i create a JIRA issue for this.


Best regards,


Jo



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

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



More information about the jboss-user mailing list