【问题标题】:Problems With Activiti OSGI and BlueprintActiviti OSGI 和蓝图的问题
【发布时间】:2017-03-21 23:31:11
【问题描述】:

我尝试在 KARAF OSGI 中使用 Activiti 和骆驼。

我从服务组合配置中复制了一些部分。

<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camel="http://camel.apache.org/schema/blueprint"
       xsi:schemaLocation="
   http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
   http://camel.apache.org/schema/blueprint http://camel.apache.org/schema/blueprint/camel-blueprint.xsd"
       xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
       xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0"
       xmlns:ext="http://aries.apache.org/blueprint/xmlns/blueprint-ext/v1.0.0">

<ext:property-placeholder />

<!--
  Setting up the process engine configuration, using an embedded H2 database together with our default Aries
  transaction manager.
-->
<bean id="dataSource" class="org.h2.jdbcx.JdbcDataSource">
    <property name="URL" value="jdbc:h2:~/activiti"/>
    <property name="user" value="sa"/>
    <property name="password" value=""/>
</bean>

<reference id="transactionManager" interface="javax.transaction.TransactionManager"/>

<bean id="configuration" class="org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration" ext:field-injection="true">
    <property name="databaseType" value="h2"/>
    <property name="dataSource" ref="dataSource"/>
    <property name="transactionManager" ref="transactionManager"/>
    <property name="databaseSchemaUpdate" value="true"/>
    <property name="transactionsExternallyManaged" value="true" />
    <property name="defaultCamelContext" value="defaultContext"/>
</bean>

<!--
  Set up the custom resolver implementation to ease integration with Camel routes
-->
<bean id="resolver" class="de.myproject.CamelAwareELResolver"/>

<reference-list availability="optional" interface="org.activiti.camel.ContextProvider">
    <reference-listener ref="resolver" bind-method="addContextProvider" unbind-method="removeContextProvider" />
</reference-list>

<reference-list availability="optional" interface="org.activiti.engine.delegate.JavaDelegate">
    <reference-listener ref="resolver" bind-method="bindService" unbind-method="unbindService" />
</reference-list>

<!--
  Set up the Activiti process engine itself
-->
<bean id="processEngineFactory" class="org.activiti.osgi.blueprint.ProcessEngineFactoryWithELResolver" init-method="init" destroy-method="destroy">
    <property name="processEngineConfiguration" ref="configuration"/>
    <property name="bundle" ref="blueprintBundle"/>
    <property name="blueprintELResolver" ref="resolver" />
</bean>

<bean id="processEngine" factory-ref="processEngineFactory" factory-method="getObject"/>

<bean id="runtimeService" factory-ref="processEngine" factory-method="getRuntimeService" />

<!--
  Register the ProcessEngine and RuntimeService as OSGi services to allow other bundles to use them
-->
<service ref="processEngine" interface="org.activiti.engine.ProcessEngine"/>
<service ref="runtimeService" interface="org.activiti.engine.RuntimeService"/>


<bean id="routeBuilder" class="de.myproject.bpmn.BpmnRestRouteBuilder"/>

<camelContext id="clientContext" trace="false" xmlns="http://camel.apache.org/schema/blueprint">
    <routeBuilder ref="routeBuilder" />        
    <route id="entryPointClient">
        <from uri="vm:client_queue"/>
        <to uri="jobsbpmn://bpmn"/>
    </route>
</camelContext>

我可以在容器中毫无问题地部署捆绑包。当我使用骆驼模块触发工作流时,我得到了这些异常:

2016-11-08 11:56:43,569 |错误 | m://client_queue | JobsBpmnProducer | 45 - 工作记录 - 1.0.0 |没有找到与此相关的 Processdefinition 标识符 ActivitiException:期望一个 Activiti Camel 模块的 SpringProcessEngineConfiguration。
类转换异常: org.activiti.engine.impl.cfg.JtaProcessEngineConfiguration 不能 转换为 org.activiti.spring.SpringProcessEngineConfiguration**

如何使用 Spring 部署符合 OSGI 的 Processengine 以使 Camel 工作?

【问题讨论】:

    标签: apache-camel osgi activiti apache-karaf blueprint-osgi


    【解决方案1】:

    这个问题可能已经在活动代码中得到修复。 见https://github.com/Activiti/Activiti/pull/519

    你可以试试最新的 Activitiy 版本吗?

    【讨论】:

    • 该解决方案包含的任何 Idear 版本?我使用 5.19.0.4
    • 5.19.0 在问题解决后发布。所以你的版本可能包括它。我仍然会给最新版本一个旋转检查。
    • 查看 Activiti 代码这个问题没有解决,@ChristianSchneider 提到的公关确实解决了 ClassCastException 但不是这个.. 查看代码 [1] CamelBehavior 总是期望 SpringProcessEngineConfiguration (行197)。 1:github.com/Activiti/Activiti/blob/master/modules/activiti-camel/…
    • 嘿@BramPouwelse 这告诉我不能在 OSGI 上下文中使用 Camel?
    • @MarcelWolf 认为你是对的,这是不可能的,Activiti 文档 [1] 也提到了 Spring 依赖项。 1:activiti.org/userguide/index.html#bpmnCamelTaskSimpleCamelCall
    猜你喜欢
    • 2012-11-22
    • 1970-01-01
    • 2012-04-18
    • 2016-12-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-08
    相关资源
    最近更新 更多