java delegate couldn't instantiate class

cancel
Showing results for 
Search instead for 
Did you mean: 
Guru
Member II

java delegate couldn't instantiate class

Hi

I am using Alfresco Process Services V 1.11.1 trying to call the delegate from the Service task. In the spring Boot i am referring Activity-Engine 5.23.0 version in the pom file

I copied the jar file to following 3 directories and still getting the above error. Not sure where i am going wrong. Kindly assist me.

  • C:\Program Files (x86)\alfresco\process-services-1.11.1\tomcat\webapps\activiti-app\WEB-INF\lib
  • C:\Program Files (x86)\alfresco\process-services-1.11.1\tomcat\bin
  • C:\Program Files (x86)\alfresco\process-services-1.11.1\tomcat\lib
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>5.23.0</version>
</dependency>

 

org.activiti.engine.ActivitiException: couldn't instantiate class com.activiti.extension.bean.AlfJavaDelegate
at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:137)
Caused by: org.activiti.engine.ActivitiClassLoadingException: Class not found: com.activiti.extension.bean.AlfJavaDelegate
at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:87)
at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:134)
... 211 common frames omitted
Caused by: java.lang.ClassNotFoundException: com.activiti.extension.bean.AlfJavaDelegate
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1360)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1182)
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)

4 Replies
openpj
Moderator
Moderator

Re: java delegate couldn't instantiate class

You should avoid to put classes and dependencies directly in the WEB-INF/lib without any consistent mechanism for doing that.

I suggest to use the APS SDK for creating custom extensions for APS. This SDK will give you the right dependencies for each APS version that you want to use. It will build the JAR, the activiti-app.war and the related Docker container with its own volume for testing and deployment purpose.

There are two different branches of this project APS SDK 1.x for APS 1.x and APS SDK 2.x for APS 2.x. You should use the latest version of the APS SDK 1.x that is 1.7.5, here the link to download the Maven project:

https://github.com/OpenPj/alfresco-process-services-project-sdk/releases/tag/v.1.7.5

Read the documentation here:

https://github.com/OpenPj/alfresco-process-services-project-sdk

The Docker plugin will deploy everything for you executing a single Maven command:

mvn clean install docker:build docker:start -Pactiviti-admin

For stopping all the containers run the following:

mvn docker:stop -Pactiviti-admin

If you don't need the Activiti Admin you can avoid to set -Pactiviti-admin in the command.

You will also find in the project a basic example of a Four Eyes process with listener and a task service with unit and integration tests! Feel free to ask more questions if you need.

Hope this helps Smiley Wink

Guru
Member II

Re: java delegate couldn't instantiate class

Hi

Thanks for your reply. I followed this sample. https://hub.alfresco.com/t5/alfresco-process-services/activiti-enterprise-developer-series-service-t.... I just want to run the delagate from the service task. 

 

In fact i enabled the following from C:\Program Files (x86)\alfresco\process-services-1.11.1\tomcat\lib\activiti-app.properties. Still getting the same error. Kindly help me

 

shell.whitelisting.enabled=true
service.task.class.whitelisting.enabled=true
class.whitelisting.enabled=true

openpj
Moderator
Moderator

Re: java delegate couldn't instantiate class

The example you followed is not based on the APS SDK, so I suggest you to bring all your extensions in the SDK project.

The SDK project will give you all the needed dependencies without adding them manually!

Hope this helps.

Guru
Member II

Re: java delegate couldn't instantiate class

Hi Thanks for your reply

I already have an spring boot application, how to use the SDK from that ? If yes could you please point me to any sample application?