cancel
Showing results for 
Search instead for 
Did you mean: 

couldn't instantiate class for a service task

nbklot3
Champ in-the-making
Champ in-the-making
Hi,
I have created a service task in my process and created corresponding java classes for it. When I deploy my bar file and start the process, I get the below error when I hit the service task -

03130003 Wrapped Exception (with status template): couldn't instantiate class com.delegate.EmailNotify

I'm unable to debug this issue. I searched the forum and tried all possible solutions posted in forum like copying the jar file to activiti-rest/WEB-INF/lib, including the jar in classpath.

Please help me fix this issue. I have attached my eclipse project with this.
22 REPLIES 22

firebird0001
Champ in-the-making
Champ in-the-making
Hi,

I have same error with one of the examples (AcmeMoneyTask).
I tried to create jar with maven and Export from eclipse and put it to libs folder, but I still get the same "couldn't instantiate" error.

nitroin
Champ in-the-making
Champ in-the-making
Same problem here, I've created my own class to do the uppercase (for an easy example):

import java.util.*;
import org.activiti.engine.delegate.*;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.activiti.engine.test.ActivitiRule;

@SuppressWarnings("unused")
public class ToUppercase implements JavaDelegate {
  
   public void execute(DelegateExecution execution) throws Exception {
     String var = (String) execution.getVariable("cliente");
     var = var.toUpperCase();
     execution.setVariable("cliente", var);
   }
  
}

And I've deploy the .jar in the tomcat webapps folder.

But at the moment of operating it here:

[img]http://img6.imagebanana.com/img/fn7j789d/Cattura.JPG[/img]


I get the couldn't instantiate the ToUppercase class excetion.

EDIT:

We apparently have resolved the problem putting the .jar file in:
>> activiti-5.9\apps\apache-tomcat-6.0.32\webapps\activiti-explorer\WEB-INF\lib

silvioneto
Champ in-the-making
Champ in-the-making
nitroin, I've just got the same problem here.

Don't you think this behavior looks like a bug?

Thanks,

Silvio Neto

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
why is it a bug if putting the jar file correctly on the classpath solves the 'problem'?

silvioneto
Champ in-the-making
Champ in-the-making
why is it a bug if putting the jar file correctly on the classpath solves the 'problem'?

Put on the both classpath, activiti-explorer and activiti-rest, is correct?

I thought explorer would use the rest API to integrate with activiti engine and just the engine would execute the service tasks. But it looks like explorer go directly to the database.

houstoniasian
Champ in-the-making
Champ in-the-making
Follow up with the previous post, I also export the jar file to the activiti-explorer/lib (does not work), then activiti-explorer/WEB-INF/lib (also does not work), then myapp/WEB-INF/lib (also does not work).  I run out of option  Smiley Sad

Tan

houstoniasian
Champ in-the-making
Champ in-the-making
I have the same problem (Class not found).  I use eclipse to export war file to Tomcat/webapps folder.  I see the class StockPrice in apache-tomcat-7.0.33\webapps\myapp\WEB-INF\classes\stock\StockPrice.class.  However, I still get the error "couldn't instantiate class stock.StockPrice".

Any help would be greatly appreciated.  Attached is the bpmn file.

Thanks,

Tan

houstoniasian
Champ in-the-making
Champ in-the-making
Never mind.  I sold the problem by manually putting the class in activiti-explorer/WEB-INF/class/ folder.  I create the StockPrice in myapp (my own application)  and expect Activiti-Explorer to find it.  I feel so stupid.

Tan

echashnik
Champ in-the-making
Champ in-the-making
Did try different approaches without luck.
Java and bpmn files are attached.

Pls advice.

THX

echashnik
Champ in-the-making
Champ in-the-making
Exception seen in chrome debugger:

org.activiti.engine.ActivitiException: couldn't instantiate class level3.activiti.designer.validation.EndPoitValidation
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:978)
org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:868)

        org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:137)
org.activiti.engine.impl.bpmn.helper.ClassDelegate.defaultInstantiateDelegate(ClassDelegate.java:242)

org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:87)
org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:134)

org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1333)
org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1167)