0 Replies Latest reply on Oct 3, 2016 7:01 PM by Jaykumar Pandya

    start jbpm process using JMS/Tomcat7/Spring

    Jaykumar Pandya Novice

      Hi,

       

      I am configuring Tomcat7 with ActiveMQ/Spring setup to start JBPM 6.3 process using JMS apart from REST API.

      my applicationContext xml file entry is as per below where i am trying to create a bean for RequestMessageBean class which is a listener for KIE.SESSION.ALL queue where i will send message to start the process.

       

       

      <jee:jndi-lookup id="notificationJmsConnectionFactory"
              jndi-name="java:/JmsXA">
          </jee:jndi-lookup>
      
      
        <bean id="executorServiceListner" class="org.jbpm.executor.impl.jms.JmsAvailableJobsExecutor" />
        <bean id="retryTrackerSingleton" class="org.kie.remote.services.jms.RetryTrackerSingleton" />
        <bean id="deploymentInfo" class="org.kie.remote.services.cdi.DeploymentInfoBean" />
        <bean id="backupIdentityProviderProducerBean" class="org.kie.remote.services.jms.request.BackupIdentityProviderProducer"/>
        <bean id="dynamicJaxbContextBean" class="org.kie.remote.services.rest.jaxb.DynamicJaxbContext" />
      
      
        <bean id="kieSessionListner" class="org.kie.remote.services.jms.RequestMessageBean" >
        <property name="factory" ref="notificationJmsConnectionFactory" />
        <property name="retryTracker" ref="retryTrackerSingleton" />
        <property name="runtimeMgrMgr" ref="deploymentInfo" />
        <property name="backupIdentityProviderProducer" ref="backupIdentityProviderProducerBean"/>
        <property name="dynamicJaxbContext" ref="dynamicJaxbContextBean"/>
        </bean>
      
      
        <bean id="kieSessionQcontainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
        <property name="connectionFactory" ref="cachingConnectionFactory"/>
        <property name="messageListener" ref="kieSessionListner"/>
        <property name="destinationName" value="jms/queue/KIE.SESSION.ALL" />
        </bean>
      
        <bean id="jmsTemplateForSession" class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory" ref="cachingConnectionFactory" />
        <property name="receiveTimeout" value="10000" />
        <property name="defaultDestination" ref="kieSessionDestination" />
        <property name="sessionTransacted" value="false" />
        <property name="sessionAcknowledgeMode" value="#{T(javax.jms.Session).AUTO_ACKNOWLEDGE}" />
        <property name="pubSubDomain" value="false" />
        <property name="messageConverter" ref="auditMessageConverter" />
        </bean>
      
        <bean id="kieSessionDestination" class="org.apache.activemq.command.ActiveMQQueue">
        <constructor-arg value="jms/queue/KIE.SESSION.ALL" />
        </bean>
      
      

       

      Also i have defined JmsXA as a resource in Tomcat7/conf/context.xml as per below

       

      <Resource name="java:/JmsXA" 
        auth="Container" 
        type="org.apache.activemq.ActiveMQConnectionFactory" 
        description="JMSConnectionFactory"
        factory="org.apache.activemq.jndi.JNDIReferenceFactory" 
        brokerURL="vm://127.0.0.1?brokerConfig=xbean:activemq.xml" 
        brokerName="bpmsAuditJms"
        useEmbeddedBroker="true"></Resource>

       

      But when i am starting Tomcat7 instance, i am getting following exception trace

      org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'notificationJmsConnectionFactory': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [JmsXA] is not bound in this Context. Unable to find [JmsXA].
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578) ~[?:?]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545) ~[?:?]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[?:?]
              at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306) ~[?:?]
              at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230) ~[?:?]
              at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302) ~[?:?]
              at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) ~[?:?]
              at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:757) ~[?:?]
              at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:861) ~[?:?]
              at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:541) ~[?:?]
              at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444) ~[?:?]
              at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326) ~[?:?]
              at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107) ~[?:?]
              at org.apache.catalina.core.StandardContext.listenerStart(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.core.StandardContext.startInternal(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.util.LifecycleBase.start(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.core.ContainerBase.addChildInternal(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.core.ContainerBase.addChild(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.core.StandardHost.addChild(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.startup.HostConfig.deployDirectory(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.catalina.startup.HostConfig$DeployDirectory.run(Unknown Source) ~[catalina.jar:7.0.59]
              at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[?:1.8.0_92]
              at java.util.concurrent.FutureTask.run(FutureTask.java:266) ~[?:1.8.0_92]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_92]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_92]
              at java.lang.Thread.run(Thread.java:745) [?:1.8.0_92]
      Caused by: javax.naming.NameNotFoundException: Name [JmsXA] is not bound in this Context. Unable to find [JmsXA].
              at org.apache.naming.NamingContext.lookup(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.naming.NamingContext.lookup(Unknown Source) ~[catalina.jar:7.0.59]
              at org.apache.naming.SelectorContext.lookup(Unknown Source) ~[catalina.jar:7.0.59]
              at javax.naming.InitialContext.lookup(InitialContext.java:417) ~[?:1.8.0_92]
              at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:155) ~[?:?]
              at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:87) ~[?:?]
              at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:152) ~[?:?]
              at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:179) ~[?:?]
              at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) ~[?:?]
              at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106) ~[?:?]
              at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:231) ~[?:?]
              at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:217) ~[?:?]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1637) ~[?:?]
              at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1574) ~[?:?]
      

       

      Any help is appreciable