How use commandAPI?

Hi,

I want use commandAPI, but I have an Exception:

ERROR [com.mdm.testUtils.AbstractBonitaITCase] org.ow2.bonita.facade.exception.BonitaInternalException: Unexpected Exception arrived in Bonita: com.mdm.bonita.command.CommandSearchProcessInstance cannot be cast to org.ow2.bonita.util.Command

I have a class extends Command<String>:

package com.mdm.bonita.command;

import org.hibernate.Query;
import org.hibernate.Session;
import org.ow2.bonita.env.Environment;
import org.ow2.bonita.persistence.db.HibernateDbSession;
import org.ow2.bonita.util.Command;

public class CommandSearchProcessInstance implements Command<String> {
 
    /** Generated uuid*/
    private static final long serialVersionUID = 3148260409538618806L;
    
    /** my variables */
    private String v;
    
    /**
     * Constructeur
     * @param variable
     */
    public CommandSearchProcessInstance(String variable) {
        this.v = variable;
    }
    
    public String execute(Environment env) throws Exception {
        // Get the hibernate session
        Session session = env.get(HibernateDbSession.class).getSession();
        // use hibernate syntax to write your queries.....
        Query query = session.createQuery("SELECT COUNT(instance) FROM org.ow2.bonita.facade.runtime.impl.InternalProcessInstance");
        
        return query.uniqueResult().toString();
    }
}

 

And after a Bonita Connexion I use this class like this:

AccessorUtil.getCommandAPI().execute(new CommandSearchProcessInstance(""));

 

I deployed my class  CommandSearchProcessInstance.java in a file jar in my Tomcat classpath.

 

Please help me...

I use bonita 5.7 with tomcat 6.