cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with invoking Activiti Process

pmsriram13
Champ in-the-making
Champ in-the-making
Hello , this is my first post and I am a newbie at Activiti.

Iam using Activiti 5.10 /Camel 2.10

Here is my Application definition:


I have Camel deployed on  tomcat 6.0.18 . I read records in an .csv file, split them and convert to an xml .
After conversion using jaxb, they are sent to an active MQ queue.
No issues so far.

I have Activiti deployed on another tomcat instance(different port) and have used camel to receive the message from the same ActiveMQ and start a process.I have added all the relevant Camel and camel related jars to the activiti-explorer /WEB-INF/lib folder and able to start tomcat and see that camel is also starting(similar to server1)

I followed the example in the Activiti in Action and got the error:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.activiti.explorer.ExplorerApp] is defined: expected single bean but found 0:
   com.vaadin.terminal.gwt.server.AbstractApplicationServlet.handleServiceException(AbstractApplicationServlet.java:999)
   com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:548)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
root cause

org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.activiti.explorer.ExplorerApp] is defined: expected single bean but found 0:
   org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:280)
   org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1106)
   org.activiti.explorer.servlet.ExplorerApplicationServlet.getNewApplication(ExplorerApplicationServlet.java:55)
   com.vaadin.terminal.gwt.server.AbstractApplicationServlet.createApplication(AbstractApplicationServlet.java:973)
   com.vaadin.terminal.gwt.server.AbstractApplicationServlet.findApplicationInstance(AbstractApplicationServlet.java:801)
   com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:456)
   javax.servlet.http.HttpServlet.service(HttpServlet.java:717


Here is my camel-application-context.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/spring"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
                                http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">

   <bean id="activemq" class="org.apache.activemq.camel.component.ActiveMQComponent">
   <property name="brokerURL" value="tcp://localhost:61616" /></bean>
   <bean id="camel" class="org.activiti.camel.CamelBehaviour">
      <constructor-arg index="0">
         <list>
            <bean class="org.activiti.camel.SimpleContextProvider">
               <constructor-arg index="0" value="PaymentActivitiProcess" />
               <constructor-arg index="1" ref="camelProcess" />
            </bean>
         </list>
      </constructor-arg>
   </bean>

   <camelContext id="camelProcess" xmlns="http://camel.apache.org/schema/spring">
      <packageScan>
         <package>com.spalamadai.payments.activiti.camel</package>
      </packageScan>
   </camelContext>

</beans>

This along with the activiti-application-context.xml and camel-application-context.xml are packaged ina  jar file copied to the activiti-explorer/WEB-INF/lib folder

My workflow file:
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="PaymentActivitiProcess" name="PaymentActivitiProcess">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Receive Payment" activiti:delegateExpression="${camel}"></serviceTask>
    <sequenceFlow id="flow1" name="to Service Task" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <serviceTask id="servicetask2" name="Service Task" activiti:class="com.spalamadai.payments.activiti.delegate.PaymentsDelegateBean"></serviceTask>
    <sequenceFlow id="flow2" name="to Service Task" sourceRef="servicetask1" targetRef="servicetask2"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow3" name="to End" sourceRef="servicetask2" targetRef="endevent1"></sequenceFlow>
  </process>

My activiti-explorer web.xml:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
   id="WebApp_ID" version="2.5">
   <display-name>Vaadin Web Application</display-name>

   <context-param>
      <description>Vaadin production mode</description>
      <param-name>productionMode</param-name>
      <param-value>true</param-value>
   </context-param>
   <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:application-context.xml</param-value>
</context-param>
  <!– To load the Spring context –>
  <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  </listener>
 
  <!– To allow session-scoped beans in Spring –>
  <listener>
    <listener-class>org.springframework.web.context.request.RequestContextListener</listener-class>
  </listener>
 
   <servlet>
      <servlet-name>Vaadin Application Servlet</servlet-name>
      <servlet-class>org.activiti.explorer.servlet.ExplorerApplicationServlet</servlet-class>
   </servlet>
   
   <servlet-mapping>
      <servlet-name>Vaadin Application Servlet</servlet-name>
      <url-pattern>/*</url-pattern>
   </servlet-mapping>

   <!– Session timeout on one day –>
   <session-config>
      <session-timeout>480</session-timeout>
   </session-config>
   </web-app>
Note: I have NOT changed the activiti-ui-context.xml and the applicationContext.xml file in activiti-explorer/WEB_INF  folder.

If I comment out the
[b]<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:application-context.xml</param-value>
</context-param>[/b]
section, I can open the Activiti Explorer application and deploy the workflow.
But on un-commenting the above section, i am not able to process the message from the queue due to this error:

21 Dec 2012 00:34:34,610 [Camel (camelProcess) thread #0 - JmsConsumer[singlePay
ment]] ERROR org.slf4j.helpers.MarkerIgnoringBase:161 - Failed delivery for (Mes
sageId: ID:MWKS331733-53204-1356071672311-1:3:1:1:1 on ExchangeId: ID-MWKS331733
-53191-1356071653002-0-2). Exhausted after delivery attempt: 1 caught: org.activ
iti.engine.ActivitiException: no processes deployed with key 'PaymentActivitiPro
cess'
org.activiti.engine.ActivitiException: no processes deployed with key 'PaymentAc
tivitiProcess'
        at org.activiti.engine.impl.persistence.deploy.DeploymentCache.findDeplo
yedLatestProcessDefinitionByKey(DeploymentCache.java:63)
        at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartPro
cessInstanceCmd.java:58)
        at org.activiti.engine.impl.cmd.StartProcessInstanceCmd.execute(StartPro
cessInstanceCmd.java:31)
        at org.activiti.engine.impl.interceptor.CommandExecutorImpl.execute(Comm
andExecutorImpl.java:24)
        at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execut
e(CommandContextInterceptor.java:42)


Any help will be greatly appreciated.
5 REPLIES 5

pmsriram13
Champ in-the-making
Champ in-the-making
Also, if I uncomment out the section : <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath*:application-context.xml</param-value>
</context-param>

I cannot open the activiti-explorer page.

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
Please edit your post and put code tags around relevant parts. That makes it a lot easier to read.

pmsriram13
Champ in-the-making
Champ in-the-making
Please edit your post and put code tags around relevant parts. That makes it a lot easier to read.

Hope that helps , would appreciate if you could take a look and help me out..

ronald_van_kuij
Champ on-the-rise
Champ on-the-rise
I have no knowledge of camel or spring, so sorry….

jbarrez
Star Contributor
Star Contributor
Sounds like there is something wrong going on with how the different spring application context files are placed and found. In your web.xml, you look up all files calls *application context … so which files do you have in WEB-INF that would match that?