cancel
Showing results for 
Search instead for 
Did you mean: 

Invoking a Spring bean from Activiti Explorer

mialtuna
Champ in-the-making
Champ in-the-making
Hello,

Is it possible to invoke Spring beans after a User Task is confirmed in a Activiti Explorer?

We are deploying our Spring application war and the Activiti Explorer war in the same app server. The problem is that if after a user task confirmed using the Explorer the process has to continue with a service task that executes a Spring method, the bean is not known for the Explorer and we have got the next exception

Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'ourBean'
at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.juel.AstMethod.invoke(AstMethod.java:79) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.juel.AstMethod.eval(AstMethod.java:75) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25) [activiti-engine-5.10.jar:5.10]
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50) [activiti-engine-5.10.jar:5.10]

As there are 2 diferents apps, they have got their own spring contexts.

What would be the best approach to solve that problem?

Thanks in advance!
21 REPLIES 21

trademak
Star Contributor
Star Contributor
Hi,

Is there a reason why you created a different set of servlet mappings?
The modeler expects the assets to be available in webapp-root/editor etc

Best regards,

mialtuna
Champ in-the-making
Champ in-the-making
Hi trademak,

I'm sorry but I don't understand your question. :?

I´ve got the explorer embedded in my app including it has a dependency as recommended me frederikheremans. It works perfectly. Everything works fine except the new editor functionallity.

What should I add/change in my configuration? Is there any problem to embed the new release in the same way I was embedding until now?

Thanks you!

trademak
Star Contributor
Star Contributor
Hi,

In the standard Activiti Explorer there's a specific set of servlet mappings like:

<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>/api/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>/editor/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>/explorer/*</url-pattern>
</servlet-mapping>

<servlet-mapping>
  <servlet-name>default</servlet-name>
  <url-pattern>/libs/*</url-pattern>
</servlet-mapping>

You have changed those and that's why the modeler functionality is not working.

Best regards,

btomas
Champ in-the-making
Champ in-the-making
Hi,
i've also got a problem with Activiti Explorer modeler embedded into my 'hello world' JSF+Spring application sharing same Spring context.

1. Go to 'Processes' -> 'Model Workspace' (the local URL http://localhost:8280/JavaServerFaces/activiti-explorer2/#processmodel/25)
2. Try to Edit my 'Demo model' by pressing the 'Edit' button the Modeler (after pressing Edit it navigates to the same 'Model Workspace' and shows the same 'Demo model'
the local URL is changed -> http://localhost:8280/JavaServerFaces/activiti-explorer2/service/editor?id=25#processmodel/25).
Creating a new model also acts the same - modeler is not opened.

* No exceptions or debug mesages appear in Tomcat
* No javascript errors (firebug used)

When 'Edit' is pressed i see two POSTS

1.
first post URL with parameters
http://localhost:8280/JavaServerFaces/activiti-explorer2/UIDL?repaintAll=1&sh=1080&sw=1920&cw=1630&c...first post response here

2.
second post URL with parameters
http://localhost:8280/JavaServerFaces/activiti-explorer2/UIDL?windowName=1&c964bfa3-c92b-4928-a9f3-e...second post response here

Environment
* java
java version "1.6.0_25"
Java(TM) SE Runtime Environment (build 1.6.0_25-b06)
Java HotSpot(TM) 64-Bit Server VM (build 20.0-b11, mixed mode)

* browser - Firefox 18.0.2 and Google Chrome 24.0.1312.57

* database - h2 in memory

* Application server - Tomcat-7.0.37

* the JSF+Spring+Activiti application
base JSF2+Spring3 application taken here and changes applied to embed the Activiti modeler based on Activiti forum post first and second
The application to reproduce the isse may be downloaded here

Questions
* What may cause the Modeler not to open and how to solve it?
* How could i debug such an issue to find out the solution?

p.s. Tijs Rademakers in his comment on February 12, 2013 at 9:42 AM has mentioned that a sample will be provided how to embed the Activiti explorer into web application. Not sure if the same integration approach gonna be used there but we're waiting for the sample!  Smiley Happy

btomas
Champ in-the-making
Champ in-the-making
By the way if upgrade Activiti version from 5.11 to 5.12 in my previously defined sample then the modeler is not opened exactly the same way.

btomas
Champ in-the-making
Champ in-the-making
i guess i have to do something with ExplorerFilter and its filter-mapping + REST servlet….. hope i'm gonna come-up with some solution shortly Smiley Happy

cirerenat
Champ in-the-making
Champ in-the-making
Is this post still valid for version 5.13? I think it would be really beneficial to so many users if there's a section in the activiti user's guide to address how to deploy activiti-explorer functionality as part of another web application.
Cheers

cirerenat
Champ in-the-making
Champ in-the-making
To be more specific, I've followed the steps above to deploy 5.13 with my web app.
* build the activiti-webapp-explorer2-5.13-ui-jar.jar
* modified the web.xml and spring application context files.
* Started my application got some class not found errros, copied the vaadin-6.8.8.jar and activiti-simple-workflow-5.13.jar.
* Started my application but got an error regarding not being able to find activitiLoginHandler, added this to my configuration

    <bean id="activitiLoginHandler" class="org.activiti.explorer.ui.login.DefaultLoginHandler">
        <property name="identityService" ref="identityService" />
    </bean>
* Now application starts fine, but when I point to the URL http://localhost:8080/myApp/activiti-explorer2/, I get
org.springframework.context.NoSuchMessageException: No message found under code 'login.username' for locale 'en_US' error.

And before I dig further, maybe I've missed a step above. Was I supposed to copy pretty much everything from the activiti-explorer to my webapp?

jbarrez
Star Contributor
Star Contributor
you are missing the property files with the transaltions, they are found under resources.

cirerenat
Champ in-the-making
Champ in-the-making
Thanks, I assumed the property file is packaged with the activiti-webapp_explorer2-5.13-ui-jar.jar file, I was wrong