cancel
Showing results for 
Search instead for 
Did you mean: 

serviceTask can not instantiate class

eranriesenfeld
Champ in-the-making
Champ in-the-making
hi activiti forum!

at first i want to send my congratulations for the work done so far, on the activiti project within the last ~4(?) month!

I am testing around with activiti and have a problem right now, when executing a process with a serviceTask contained.

in my bpmn20.xml I had defined a service Task like this:


<serviceTask id="jstSetzeNamen" name="Setze Namen"
         activiti:class="path.to.my.ConcreteClass" />

in addition to the bpmn20.xml I wrote an AntTask which deploys my definition, some forms and the compiled class in a .bar. When executing the deployed process it throws an exception with following stacktrace (from catalina log):


Exception from executeScript - redirecting to status template error: 07220027 Wrapped Exception (with status template): couldn't instantiate class path.to.my.ConcreteClass
[…]
Caused by: org.activiti.ActivitiException: couldn't instantiate class […]
Caused by: org.activiti.ActivitiException: couldn't load class [..]
Caused by: java.lang.ClassNotFoundException: path.to.my.ConcreteClass […]

obviously my class can not be found, did I choos a wrong way for deploying!?

Any ideas? I hope my approach for deploying a .class to activiti isn't that wrong

thanks for help in advance.

regards Eran

P.S.:
my configuration: activiti on mysql, jre1.6.0_20, tomcat 6.0.26 all on ubuntu 10.04

P.P.S.:
well, I deployed my class in a .jar to tomcat/lib folder and now it seems to work after tomcat restart. is this the way it is proposed to be?
8 REPLIES 8

tombaeyens
Champ in-the-making
Champ in-the-making
yes it is

jbarrez
Star Contributor
Star Contributor
That is the easiest way to get it working, yes (If you are testing the process through Explorer).

If you are building your own application, you must make sure that the class is on the same classpath as on which you create the process engine on.

jeff1
Champ in-the-making
Champ in-the-making
I think it would be great if we can obtain the existing service objects of the application with serviceTask.  : )

tombaeyens
Champ in-the-making
Champ in-the-making
I think it would be great if we can obtain the existing service objects of the application with serviceTask.  : )

Jeff, can you explain that suggestion a bit more elaborate?

jeff1
Champ in-the-making
Champ in-the-making
so sorry for my english, tom : (

I said that because in my mind(I don't know what it is like now), jbpm4 uses relfect to invoke the target java method, which may newly create a target object, for example:

<java name="greet"
        class="org.jbpm.examples.java.JohnDoe"
        method="hello"
        var="answer">
of course, we can use jndi to obtain object in jbpm4 too.

now, let's assume that there are some domain service objects inside my application, which are stateful and have been initiated with specific business logic, how can I access such objects with service task? since I can not newly create one.
need I manually expose them to somewhat like jndi, do some integration work, or I can access them more conveniently.

jbarrez
Star Contributor
Star Contributor
The service task does indeed do the instantiation, which has as a consequens that the beans are stateless.

However, I do believe that when you use Spring for example, you can reference a stateful bean from the service task (I havent tried this yet, though)

rrabbit
Champ in-the-making
Champ in-the-making
That is the easiest way to get it working, yes (If you are testing the process through Explorer).

is there any way to update the jar file in the tomcat/lib folder without having to restart tomcat?

jbarrez
Star Contributor
Star Contributor
No, unfortunately not. That's the way Tomcat works (and JBoss too and probably other app servers too).

When you have your own web application with activiti jar inside, you can however hot deploy you war, and that will give you what you need.