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

jbarrez
Star Contributor
Star Contributor
The only thing you need to do is is to make sure the EmailNotify class is present in /WEB-INF/lib of activiti-rest.  So, there must be an error in your jar.

nbklot3
Champ in-the-making
Champ in-the-making
Hi,
I don't see any error in my classes and it just has a simple sys out statements. I have attached the bar and jar files, can you help me figure out the issue?

nbklot3
Champ in-the-making
Champ in-the-making
attached bar file

nbklot3
Champ in-the-making
Champ in-the-making
Hi,

I found out the issue. the issue was with the jar generated by using ""Create deployment artifacts" option. I'm not sure what is missing in the jar genearted using activiti designer, but i created a jar manually using "Export" option and added it to activiti-rest lib - it worked.

If possible please check this and provide us a fix. Thanks!

jbarrez
Star Contributor
Star Contributor
Moved to designer forum

tiesebarrell
Champ in-the-making
Champ in-the-making
nbklot3,

the generated bar file will and should not actually contain the compiled classes. So the workaround you found by including it in the activiti-rest project is actually the correct solution: you should make sure the class is on the classpath in the runtime, because that's the way it's resolved, not from the .bar file.

nbklot3
Champ in-the-making
Champ in-the-making
Hi,

Will "create deployment artifacts" option not generate the jar file ? All I'm saying is I used the jar file generated and it didn't work. But the manual export of classes as a jar file did the magic. I didnt see any error in accessing the class files in the manual export of jar? Do I have to always follow this and not rely on the jar generated when I use create deployment artifacts option?

thanks,
Arun

tiesebarrell
Champ in-the-making
Champ in-the-making
Yes, that's what I mean. The "generated jar" of Activiti Designer is not really a jar file, but a bar (business archive) file that is only meant to contain the process files. The classes are not included in Designer's export and shouldn't be. You have to make sure they're on the classpath of Activiti's engine by creating your own "real" jar file. One way to do that is to do a Maven install on the project, because Designer's projects have a Maven POM file in there by default.

jbarrez
Star Contributor
Star Contributor
@Tiese: sorry for moving this post, I should have known this too (but didnt read to careful ;-))