AnsweredAssumed Answered

Call jar from alfresco workflow

Question asked by biker89 on May 25, 2017
Latest reply on Jun 1, 2017 by biker89

I have a jar file with this structure:
ActivitiProj

-src

      --com.mycompany.activiti

         ---Decision.java

-META-INF

      --Manifest.mf

-lib

       --activiti-engine-5.22.0.jar

-alfresco

      --extension

         ---custom-action-context.xml

 

Decision.java

package com.mycompany.activiti;
import org.activiti.engine.delegate.DelegateExecution;
import org.activiti.engine.delegate.JavaDelegate;

public class Decision implements JavaDelegate
{     
     @Override
     public void execute(DelegateExecution execution) throws Exception
     {
          System.out.println("success test");
     }
}

 

custom-action-context.xml

<?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="custom-action" parent="JavaDelegate" class="com.mycompany.activiti.Decision"/>
</beans>

 

I stop alfresco, add this jar to alfresco-community\tomcat\webapps\alfresco\WEB-INF\lib

Then in my workflow I add 

<serviceTask id="alfrescoStartScripttask" activiti:class="com.mycompany.activiti.Decision"/>

I start alfresco without any errors in log, deploy my workflow successfull, but when I try to start workflow I have this error in log:

Caused by: java.lang.ClassNotFoundException: com.mycompany.activiti.Decision
     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1720)
     at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1571)
     at java.lang.Class.forName0(Native Method)
     at java.lang.Class.forName(Unknown Source)
     at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:291)
     at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:68)
     ... 153 more

 

Can anybody help me with this problem? Or maybe there are another ways to call external jars from workflow?
Thank you

Outcomes