AnsweredAssumed Answered

delegateExpression failed to find Spring managed bean

Question asked by chamindakiriwendala on Sep 5, 2013
Latest reply on Nov 26, 2013 by rahulkrs
Hi Friends,

I'm trying to test a very simple process with one sevice task, and I want to manage Java Delegate class as a spring managed bean. I've followed all the steps described in Activiti User Guide, but still I'm getting "Bean Not Found" error. Highly appriciate, if anybody can help me figure out my missing point. I have highlighted the log with my findings.

[size=15]
Platform : apache-servicemix-4.4.2
Process : src/main/resources/OSGI-INF/activiti/testSample.bpmn20.xml
[/size]


  <process id="testSample" name="Test Sample Process" isExecutable="true">
    <startEvent id="startevent1" name="Start"></startEvent>
    <serviceTask id="servicetask1" name="Service Task" activiti:delegateExpression="${signalSupport}"></serviceTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="servicetask1"></sequenceFlow>
    <endEvent id="endevent1" name="End"></endEvent>
    <sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="endevent1"></sequenceFlow>
  </process>
 

[size=15]
Spring Context : src/main/resources/META-INF/spring/schememanagement.bpm.cfg.xml
[/size]



<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:ctx="http://www.springframework.org/schema/context"
      xmlns:tx="http://www.springframework.org/schema/tx"
      xmlns:osgi="http://www.springframework.org/schema/osgi"
      xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
      xmlns:jee="http://www.springframework.org/schema/jee"
       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-2.0-M1.xsd
                        http://www.springframework.org/schema/context
                        http://www.springframework.org/schema/context/spring-context.xsd
                        http://www.springframework.org/schema/tx
                        http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
                        http://www.springframework.org/schema/osgi
                        http://www.springframework.org/schema/osgi/spring-osgi.xsd
                        http://www.springframework.org/schema/osgi-compendium
                        http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd
                        http://www.springframework.org/schema/jee
                        http://www.springframework.org/schema/jee/spring-jee-3.0.xsd">
      
      <osgi:reference id="processEngine" interface="org.activiti.engine.ProcessEngine" />
   <osgi:reference id="bpmnContext" interface="org.activiti.karaf.support.BpmnContext" />
   
   <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
   <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
   <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
   <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
   <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
   <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
   
   <bean id="signalSupport" class="my.gov.perkeso.schememanagement.bpm.delegate.ScoRecommendationSignal">
       <property name="runtimeService" ref="runtimeService" />
    </bean>
                       
    <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="locations">
            <list>
                <value>classpath:app.properties</value>
            </list>
        </property>
    </bean>

    <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
        <property name="brokerURL" value="${jms.broker.connection.url}"/>
        <property name="userName" value="${jms.broker.username}" />
        <property name="password" value="${jms.broker.password}" />
    </bean>

    <bean id="pooledConnectionFactory"
          class="org.apache.activemq.pool.PooledConnectionFactory" init-method="start" destroy-method="stop">
        <property name="maxConnections" value="${jms.broker.pool.max.connection}"/>
        <property name="connectionFactory" ref="jmsConnectionFactory"/>
        <property name="maximumActive" value="${jms.broker.pool.max.active}" />
        <property name="expiryTimeout" value="${jms.broker.pool.expiry.timeout}" />
    </bean>

    <bean class="org.springframework.jms.connection.JmsTransactionManager" id="jmsTransactionManager">
        <property name="connectionFactory" ref="pooledConnectionFactory"/>
    </bean>

    <bean class="org.apache.activemq.camel.component.ActiveMQComponent">
        <property name="connectionFactory" ref="pooledConnectionFactory" />
        <property name="transactionManager" ref="jmsTransactionManager"/>
        <property name="transacted" value="true"/>
    </bean>
   
    <camel:camelContext xmlns="http://camel.apache.org/schema/spring" id="schememanagement-bpm">
        <dataFormats>
            <jaxb id="schememanagementMessage" contextPath="my.gov.perkeso.schememanagement.bpm.esb" />
        </dataFormats>
   
        <route>
           <from uri="direct:getPreferredCommChannel"/>
           <marshal ref="schememanagementMessage" />
           <to uri="activemq:queue:getPreferredCommChannel"/>
           <unmarshal ref="schememanagementMessage" />
        </route>
       
        <route>
           <from uri="direct:closeNTB"/>
           <marshal ref="schememanagementMessage" />
           <to uri="activemq:queue:closeSchemeCase"/>
        </route>
    </camel:camelContext>
</beans>


[size=15]
ServiceMix Log :
[/size]


[size=14]
18:54:40,150 | INFO  | 495257133889.tmp | BpmnDeployer                     |  -  -  | Processing resource OSGI-INF/activiti/testSample.bpmn20.xml
18:54:40,330 | INFO  | 495257133889.tmp | BpmnParse                        |  -  -  | XMLSchema currently not supported as typeLanguage
18:54:40,330 | INFO  | 495257133889.tmp | BpmnParse                        |  -  -  | XPath currently not supported as expressionLanguage
18:54:42,283 | INFO  | 495257133889.tmp | ultOsgiApplicationContextCreator | 76 - org.springframework.osgi.extender - 1.2.1 | Discovered configurations {osgibundle:/META-INF/spring/*.xml} in bundle [schememanagement-workflow-support (schememanagement-workflow-support)]
18:54:42,303 | INFO  | xtenderThread-23 | OsgiBundleXmlApplicationContext  | 65 - org.springframework.context - 3.0.6.RELEASE | Refreshing OsgiBundleXmlApplicationContext(bundle=schememanagement-workflow-support, config=osgibundle:/META-INF/spring/*.xml): startup date [Wed Sep 04 18:54:42 SGT 2013]; root of context hierarchy
18:54:42,304 | INFO  | xtenderThread-23 | OsgiBundleXmlApplicationContext  | 65 - org.springframework.context - 3.0.6.RELEASE | Application Context service already unpublished
18:54:53,582 | INFO  | xtenderThread-23 | XmlBeanDefinitionReader          | 66 - org.springframework.beans - 3.0.6.RELEASE | Loading XML bean definitions from URL [bundle://988.0:0/META-INF/spring/schememanagement.bpm.cfg.xml]
18:54:53,702 | INFO  | xtenderThread-23 | PropertyPlaceholderConfigurer    | 70 - org.springframework.core - 3.0.6.RELEASE | Loading properties file from OSGi resource[classpath:app.properties|bnd.id=988|bnd.sym=schememanagement-workflow-support]
18:54:53,723 | INFO  | xtenderThread-23 | WaiterApplicationContextExecutor | 76 - org.springframework.osgi.extender - 1.2.1 | No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=schememanagement-workflow-support, config=osgibundle:/META-INF/spring/*.xml)
18:54:53,905 | INFO  | xtenderThread-24 | DefaultListableBeanFactory       | 66 - org.springframework.beans - 3.0.6.RELEASE | Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1e8810f: defining beans [processEngine,bpmnContext,repositoryService,runtimeService,taskService,historyService,managementService,identityService,signalSupport,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,jmsConnectionFactory,pooledConnectionFactory,jmsTransactionManager,org.apache.activemq.camel.component.ActiveMQComponent#0,schememanagement-bpm:beanPostProcessor,schememanagement-bpm]; root of factory hierarchy
18:54:53,923 | INFO  | xtenderThread-24 | OsgiServiceProxyFactoryBean      | 73 - org.springframework.osgi.core - 1.2.1 | Looking for mandatory OSGi service dependency for bean [processEngine] matching filter (objectClass=org.activiti.engine.ProcessEngine)
18:54:53,924 | INFO  | xtenderThread-24 | OsgiServiceProxyFactoryBean      | 73 - org.springframework.osgi.core - 1.2.1 | Found mandatory OSGi service for bean [processEngine]
18:54:53,927 | INFO  | xtenderThread-24 | OsgiServiceProxyFactoryBean      | 73 - org.springframework.osgi.core - 1.2.1 | Looking for mandatory OSGi service dependency for bean [bpmnContext] matching filter (objectClass=org.activiti.karaf.support.BpmnContext)
18:54:53,927 | INFO  | xtenderThread-24 | OsgiServiceProxyFactoryBean      | 73 - org.springframework.osgi.core - 1.2.1 | Found mandatory OSGi service for bean [bpmnContext]
18:54:53,961 | INFO  | xtenderThread-24 | OsgiSpringCamelContext           | 91 - org.apache.camel.camel-core - 2.8.5 | JMX enabled. Using ManagedManagementStrategy.
18:54:53,973 | INFO  | xtenderThread-24 | OsgiSpringCamelContext           | 91 - org.apache.camel.camel-core - 2.8.5 | Apache Camel 2.8.5 (CamelContext: schememanagement-bpm) is starting
18:54:54,004 | INFO  | xtenderThread-24 | AnnotationTypeConverterLoader    | 91 - org.apache.camel.camel-core - 2.8.5 | Found 3 packages with 15 @Converter classes to load
18:54:54,010 | INFO  | xtenderThread-24 | DefaultTypeConverter             | 91 - org.apache.camel.camel-core - 2.8.5 | Loaded 171 core type converters (total 171 type converters)
18:54:54,010 | INFO  | xtenderThread-24 | Activator                        | 91 - org.apache.camel.camel-core - 2.8.5 | Found 0 @Converter classes to load
18:54:54,012 | INFO  | xtenderThread-24 | Activator                        | 91 - org.apache.camel.camel-core - 2.8.5 | Found 2 @Converter classes to load
18:54:54,014 | INFO  | xtenderThread-24 | Activator                        | 91 - org.apache.camel.camel-core - 2.8.5 | Found 1 @Converter classes to load
18:54:54,015 | INFO  | xtenderThread-24 | Activator                        | 91 - org.apache.camel.camel-core - 2.8.5 | Found 2 @Converter classes to load
18:54:54,015 | INFO  | xtenderThread-24 | Activator                        | 91 - org.apache.camel.camel-core - 2.8.5 | Found 2 @Converter classes to load
18:54:54,993 | INFO  | xtenderThread-24 | JaxbDataFormat                   | 520 - org.apache.camel.camel-jaxb - 2.8.5 | Creating JAXBContext with contextPath: my.gov.perkeso.schememanagement.bpm.esb and ApplicationContextClassLoader: BundleDelegatingClassLoader for [schememanagement-workflow-support (schememanagement-workflow-support)]
18:54:55,430 | INFO  | xtenderThread-24 | OsgiSpringCamelContext           | 91 - org.apache.camel.camel-core - 2.8.5 | Route: route31 started and consuming from: Endpoint[direct://getPreferredCommChannel]
18:54:55,442 | INFO  | xtenderThread-24 | OsgiSpringCamelContext           | 91 - org.apache.camel.camel-core - 2.8.5 | Route: route32 started and consuming from: Endpoint[direct://closeNTB]
18:54:55,446 | INFO  | xtenderThread-24 | OsgiSpringCamelContext           | 91 - org.apache.camel.camel-core - 2.8.5 | Total 2 routes, of which 2 is started.
18:54:55,446 | INFO  | xtenderThread-24 | OsgiSpringCamelContext           | 91 - org.apache.camel.camel-core - 2.8.5 | Apache Camel 2.8.5 (CamelContext: schememanagement-bpm) started in 1.473 seconds
18:54:55,449 | INFO  | xtenderThread-24 | OsgiBundleXmlApplicationContext  | 65 - org.springframework.context - 3.0.6.RELEASE | Publishing application context as OSGi service with properties {org.springframework.context.service.name=schememanagement-workflow-support, Bundle-SymbolicName=schememanagement-workflow-support, Bundle-Version=0.0.1.SNAPSHOT}
18:54:55,452 | INFO  | xtenderThread-24 | ContextLoaderListener            | 76 - org.springframework.osgi.extender - 1.2.1 | Application context successfully refreshed (OsgiBundleXmlApplicationContext(bundle=schememanagement-workflow-support, config=osgibundle:/META-INF/spring/*.xml))
18:54:59,860 | INFO  | qtp22183366-74   | BpmnElResolver                   |  -  -  | ############# ELResolver getValue called…

18:54:59,861 | INFO  | qtp22183366-74   | OsgiBundleXmlApplicationContext  | 65 - org.springframework.context - 3.0.6.RELEASE | Refreshing OsgiBundleXmlApplicationContext(bundle=org.activiti.karaf.support, config=osgibundle:/META-INF/spring/*.xml): startup date [Wed Sep 04 18:54:59 SGT 2013]; root of context hierarchy
18:54:59,867 | INFO  | qtp22183366-74   | OsgiBundleXmlApplicationContext  | 65 - org.springframework.context - 3.0.6.RELEASE | Unpublishing application context OSGi service for bundle activiti-karaf-support (org.activiti.karaf.support)
18:54:59,867 | INFO  | qtp22183366-74   | DefaultListableBeanFactory       | 66 - org.springframework.beans - 3.0.6.RELEASE | Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@985158: defining beans [bpmnCfg,org.springframework.beans.factory.config.PropertyPlaceholderConfigurer#0,bpmn.config,activiti.db.h2.setup,activiti.dataSource,transactionManager,processEngineConfiguration,bpmnExpressionManager,bpmnScriptResolverFactory,processEngine,bpmnContext,repositoryService,runtimeService,taskService,historyService,managementService,bpmnContextOSGi,processEngineOSGi,repositoryServiceOSGi,runtimeServiceOSGi,taskServiceOSGi,historyServiceOSGi,managementServiceOSGi]; root of factory hierarchy
18:54:59,869 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@682382]
18:54:59,872 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@f36261]
18:54:59,874 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@21d55f]
18:54:59,877 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@d03a93]
18:54:59,879 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@779cca]
18:54:59,907 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@16e1995]
18:54:59,913 | INFO  | qtp22183366-74   | OsgiServiceFactoryBean           | 73 - org.springframework.osgi.core - 1.2.1 | Unregistered service [ServiceRegistrationWrapper for org.apache.felix.framework.ServiceRegistrationImpl@d3c580]
18:54:59,914 | INFO  | qtp22183366-74   | JobExecutor                      |  -  -  | Shutting down the JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor].
18:54:59,914 | INFO  | Thread-63        | AcquireJobsRunnable              |  -  -  | JobExecutor[org.activiti.engine.impl.jobexecutor.DefaultJobExecutor] stopped job acquisition
18:54:59,915 | INFO  | qtp22183366-74   | H2DBSetup                        |  -  -  | Stopping H2 DB…
18:54:59,918 | INFO  | qtp22183366-74   | BpmnConfigProperties             |  -  -  |
BpmnConfig
localDB=true,
h2dbTcpPort=9092,
dsDriverClass=com.mysql.jdbc.Driver,
dsUrl=jdbc:mysql://localhost:3306/activiti,
dsUsername=root,
dsPassword=****,
databaseSchemaUpdate=true,
mailServerHost=localhost,
mailServerPort=25,
jobExecutorActivate=true,
history=full

18:55:02,171 | INFO  | qtp22183366-74   | XmlBeanDefinitionReader          | 66 - org.springframework.beans - 3.0.6.RELEASE | Loading XML bean definitions from URL [bundle://286.0:0/META-INF/spring/beans.xml]
18:55:02,467 | INFO  | qtp22183366-74   | WaiterApplicationContextExecutor | 76 - org.springframework.osgi.extender - 1.2.1 | No outstanding OSGi service dependencies, completing initialization for OsgiBundleXmlApplicationContext(bundle=org.activiti.karaf.support, config=osgibundle:/META-INF/spring/*.xml)
18:55:02,476 | INFO  | qtp22183366-74   | BpmnElResolver                   |  -  -  | Bean signalSupport Not found
18:55:02,484 | ERROR | qtp22183366-74   | CommandContext                   |  -  -  | Error while closing command context

org.activiti.engine.ActivitiException: Unknown property used in expression
   at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:55)[283:org.activiti.engine:5.9.0]
   at org.activiti.engine.impl.bpmn.behavior.ServiceTaskDelegateExpressionActivityBehavior.execute(ServiceTaskDelegateExpressionActivityBehavior.java:53)[283:org.activiti.engine:5.9.0]
[/size]

Outcomes