AnsweredAssumed Answered

Undeploy Custom Workflow

Question asked by priyesh on Mar 9, 2015
Latest reply on Mar 9, 2015 by maulikjajal
Hello!!Good Day!!

I am trying to undeploy a custom workflow developed by me in Alfresco Community edition 5.0 c. As there is no workflow console available here, I have used the Java-backed web script method. Following are my files used along with their location.
The error which is obtained is shown in the log file.

1> simple.get.desc.xml  location-C:\Alfresco\tomcat\webapps\alfresco\WEB-                    INF\classes\alfresco\templates\webscripts\org\alfresco\demo

     <webscript>
     <shortname>The World's Simplest Webscript</shortname>
     <description>Hands back a little bit of JSON</description>
     <url>/demo/simple</url>
     <authentication>none</authentication>
     <format default="json">argument</format>
     </webscript>


2>web-scripts-application-context.xml  location-C:\Alfresco\tomcat\webapps\alfresco\WEB-INF\classes\alfresco

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE beans PUBLIC '-//SPRING//DTD BEAN//EN'                      'http://www.springframework.org/dtd/spring-beans.dtd'>
<beans>
   <bean id="webscript.org.alfresco.demo.simple.get"
      class="org.alfresco.module.demoscripts.SimpleWebScript"
      parent="webscript">
   </bean>
</beans>


3>SimpleWebScript location-C:\Alfresco\tomcat\webapps\alfresco\WEB-      INF\classes\org\alfresco\module\demoscripts

public class SimpleWebScript extends AbstractWebScript
{
    public void execute(WebScriptRequest req, WebScriptResponse res)
        throws IOException
    {
       try
       {       
       WorkflowService wfService =    getServiceRegistry().getWorkflowService();
List<WorkflowDefinition> workFlowDefinitions = wfService.getAllDefinitions();         for(WorkflowDefinition wfd : workFlowDefinitions){            String wfId = wfd.getId();
List<String> excludeList = new ArrayList<String>();
excludeList.add("activiti$leave2:10:2204");
wfService.undeployDefinition(wfId);
}
}
catch(JSONException e)
   {
          throw new WebScriptException("Unable to serialize JSON");
       }
    }
    protected ServiceRegistry getServiceRegistry() {
       
       ProcessEngineConfigurationImpl config = Context.getProcessEngineConfiguration();
       
       ServiceRegistry registry = (ServiceRegistry) config.getBeans().get(ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
       if (registry == null) {
       throw new RuntimeException(
       "Service-registry not present in ProcessEngineConfiguration beans, expected ServiceRegistry with key" +
       ActivitiConstants.SERVICE_REGISTRY_BEAN_KEY);
       }
       else
       {
       
          System.out.println("————— config =null");
       }
       return registry;
       
}


4>The log file

SEVERE: Allocate exception for servlet apiServlet
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'webscripts.authenticator.basic' is defined
   at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:575)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1111)
   at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:276)
   at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
   at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1117)
   at org.springframework.extensions.webscripts.servlet.WebScriptServlet.init(WebScriptServlet.java:82)
   at javax.servlet.GenericServlet.init(GenericServlet.java:158)
   at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1284)
   at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1197)
   at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:864)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:134)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
   at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
   at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
   at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
   at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2441)
   at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:2430)
   at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
   at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
   at java.lang.Thread.run(Unknown Source)

Outcomes