cancel
Showing results for 
Search instead for 
Did you mean: 

Activiti Wrapped Exception

evan
Champ in-the-making
Champ in-the-making
Hi All.

     I have define a sample flow with eclipse  and make a bar with eclipse deployment . I can see my Test.class in bar deploy the bar and run the process on activiti explorer . tomcat throw exception . error message is : "00190005 Wrapped Exception (with status template): couldn't instantiate class org.test.Test"

activiti.bar
|-my_bpmn2_diagram.activiti.bpmn20.xml
|_org
    |_test
         |_Test.class

where is wrong? I have add jar to ${activiti tomcat}/webapps/activiti-rest/lib and ${activiti tomcat}//webapps/activiti-explorer/WEB-INF/lib/
15 REPLIES 15

frederikherema1
Star Contributor
Star Contributor
Evan,

As stated in the user-guide (Deployment > Java Classes http://www.activiti.org/userguide/index.html#N105A9), your java-classes should be in a seperate JAR-file on the classpath (${activiti tomcat}/webapps/activiti-rest/lib for demo-setup).

Moving this topic to Activiti User forum.

jill
Champ in-the-making
Champ in-the-making
Hi, I have the same problem.. Smiley Indifferent

I have already add a jar containing my classes to the folder (tomcat/${my project}/webapp/lib)
and restart tomcat,
but it still  error in process…. ……who can help me?

01220002 Wrapped Exception (with status template): couldn't instantiate class test.test

                                             Jill

jbarrez
Star Contributor
Star Contributor
If you are using Explorer as installed in the demo setup, reread Frederik's comment:

your java-classes should be in a seperate JAR-file on the classpath (${activiti tomcat}/webapps/activiti-rest/lib for demo-setup

hlux
Champ in-the-making
Champ in-the-making
Hello,

unfortunately I'm having the same problem here, although I believe to have
followed the user guide correctly.

a taskListener is referenced in the BPMN2.0 like this

<userTask id="usertask1" name="Abrechnung erstellen" activiti:candidateGroups="lohnbuero" activiti:formKey="/forms/abrechnung_erstellen.form">
      <extensionElements>
        <activiti:taskListener event="complete" class="de.abrechnung.listeners.StoreLastAssigneeListener"></activiti:taskListener>
      </extensionElements>
</userTask>

I used the eclipse designer to generate the deployment artifacts, as are :
abrechnung-erstellen.bar
abrechnung-erstellen.jar

I deployed the process via activiti-probe and copied the .jar file to
{activitiDemo}/apps/apache-tomcat-6.0.29/webapps/activiti-rest/WEB-INF/lib/

I used that,because the user guide said…"This is the same location where the activiti-engine jar is located"

(I also tried) {activitiDemo}/apps/apache-tomcat-6.0.29/webapps/activiti-rest/lib/
…same error

After that I restarted the demo. (ant demo.stop / ant demo.start)

When I start the process from the activiti-explorer the form shows up correctly, but on "complete" the
well known error message shows up.
catalina.out says the following

01230000 Wrapped Exception (with status template): couldn't instantiate class de.abre
chnung.listeners.StoreLastAssigneeListener
        at org.springframework.extensions.webscripts.AbstractWebScript.createStatusException(AbstractWebScript.java:742)
        at org.springframework.extensions.webscripts.DeclarativeWebScript.execute(DeclarativeWebScript.java:167)
.
.
.
Caused by: org.activiti.engine.ActivitiException: couldn't instantiate class de.abrechnung.listeners.StoreLastAssigneeListener
        at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:114)
        at org.activiti.engine.impl.bpmn.ClassDelegate.instantiateDelegate(ClassDelegate.java:117)
.
.
.
Caused by: org.activiti.engine.ActivitiException: Couldn't load class de.abrechnung.listeners.StoreLastAssigneeListener
        at org.activiti.engine.impl.util.ReflectUtil.loadClass(ReflectUtil.java:64)
        at org.activiti.engine.impl.util.ReflectUtil.instantiate(ReflectUtil.java:111)

to make sure it's there, i did a grep on the lib folder

grep "de/abrechnung/listeners/StoreLastAssigneeListener" activiti-5.2/apps/apache-tomcat-6.0.29/webapps/activiti-rest/WEB-INF/lib/*
Binary file activiti-5.2/apps/apache-tomcat-6.0.29/webapps/activiti-rest/WEB-INF/lib/abrechnung-erstellen.jar matches

I am pretty sure that it's my fault, but I'm running out of ideas what I could have done wrong.
-The java version of the Listener classes are 1.5 and the server is running on java 6 (so that shouldn't be a problem)
-The package and class name seems to be right in the BPMN2.0 file
-The correct class is tried to be loaded and instantiated
-The jar apparently contains that class

I'd really appreciate any helpful hint Smiley Happy

thank you

frederikherema1
Star Contributor
Star Contributor
Hi,

Does your class use any external dependencies which are not part of activiti?

The root cause of the exception (org.activiti.engine.ActivitiException: Couldn't load class de.abrechnung.listeners.StoreLastAssigneeListener) is currently not exposed, but will be in 5.3. This way users will be able to see if its a class not found or another issue that causes the class loading failure.

hlux
Champ in-the-making
Champ in-the-making
Hi,

thanks for you reply,
I was already missing the root cause exception Smiley Happy
The Tasklistener is very basic and only imports from org.activiti.engine.


package de.abrechnung.listeners;

import org.activiti.engine.delegate.DelegateTask;
import org.activiti.engine.impl.pvm.delegate.TaskListener;

public class StoreLastAssigneeListener implements  TaskListener {


public void notify(DelegateTask delegateTask) {
  delegateTask.setVariable("lastAssignee",delegateTask.getAssignee());
}

}

My best chance to find the error now is to debug the webapp and see what I can find out, I presume.

greetings

frederikherema1
Star Contributor
Star Contributor
Hi,

Yes, that would be my next suggestion Smiley Wink Put a breakpoint in org.activiti.engine.impl.util.ReflectUtil.loadClass() to get the root cause (or use activiti trunk build where root-cause is added Smiley Very Happy )

hlux
Champ in-the-making
Champ in-the-making
I had a look at the classloader at runtime and the jar file I was looking for
was in the URL list.
So the jar was stored in the right path and the classloader did find it.
But the classes in the jar were not found and couldn't be instantiated.

It seems that the jar file that was created by the "create deployment artifacts" - tool
didn't have the right format. It was a valid zip file, however it didn't have a MANIFEST.MF file.
I don't know if that is already the reason (maybe I should know).

When I created the jar using the export->Java->jar  tool in eclipse
everything worked just fine. The classes were found and instantiated.


Thanks for your replies

jbarrez
Star Contributor
Star Contributor
Interesting finding. I'm moving the topic to the Designer forum.