与Activiti集成时ConversionNotSupportedException

时间:2014-10-04 22:26:47

标签: java spring maven activiti

我正在尝试与我的项目的activiti-engine集成。我的父pom使用spring 3.1.1

这是我的pom.xml中的activiti配置:

<dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-engine</artifactId>
            <version>5.16.3</version>
            <exclusions>
            <exclusion>
                <artifactId>spring-beans</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>

        </exclusions>
        </dependency>
        <dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-spring</artifactId>
            <version>5.16.3</version>
            <exclusions>
            <exclusion>
                <artifactId>spring-context</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-jdbc</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-orm</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-core</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-test</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            <exclusion>
                <artifactId>spring-tx</artifactId>
                <groupId>org.springframework</groupId>
            </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.2.132</version>
        </dependency>

这里也是我的beans.xml

       <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
        <property name="driverClass" value="org.h2.Driver" />
        <property name="url" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
        <property name="username" value="sa" />
        <property name="password" value="" />
      </bean>

  <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
  </bean>

  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="databaseSchemaUpdate" value="true" />
    <property name="jobExecutorActivate" value="false" />
  </bean>

  <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
    <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  </bean>

  <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" />

    <!-- Implementation class for pricingserv-->
    <bean id="pricingServBean" class="com.paypal.pricing.service.core.PricingServImpl">
    <property name="runtimeService" ref="runtimeService"/>
    </bean>

以下是我尝试访问runtimeService的地方

   public class PricingServImpl implements PricingServ {

    private static Logger mLogger = Logger.getInstance(PricingServImpl.class);

    private RuntimeService runtimeService;

    public void setRuntimeService(RuntimeService runtimeService) {
        this.runtimeService = runtimeService;
      }

但我遇到了以下

Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property      value of type 'org.activiti.engine.impl.RuntimeServiceImpl' to required type 'org.activiti.engine.RuntimeService' for property 'runtimeService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [org.activiti.engine.impl.RuntimeServiceImpl] to required type [org.activiti.engine.RuntimeService] for property 'runtimeService': no matching editors or conversion strategy found
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:485) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:516) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:510) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1406) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1365) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    ... 19 more
Caused by: java.lang.IllegalStateException: Cannot convert value of type [org.activiti.engine.impl.RuntimeServiceImpl] to required type [org.activiti.engine.RuntimeService] for property 'runtimeService': no matching editors or conversion strategy found
    at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:241) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:470) [spring-beans-3.1.1.RELEASE.jar:3.1.1.RELEASE]
    ... 25 more

有没有人见过类似的问题。

1 个答案:

答案 0 :(得分:1)

  

无法将[org.activiti.engine.impl.RuntimeServiceImpl]类型的值转换为所需类型[org.activiti.engine.RuntimeService]

这意味着(a)你有不兼容的所需界面&amp;提供实现或(b)您有一些类加载器问题,其中所需的接口在不同的类加载器中加载两次。

另请查看堆栈跟踪中的最后一个异常 - &#34; ... 25 more&#34;

隐藏的内容