与Activiti集成时发生ConversionNotSupportedException [英] ConversionNotSupportedException while integrating with Activiti
问题描述
我正在为我的项目与activiti-engine集成.我的父pom使用spring 3.1.1
I am trying to integrate with activiti-engine for my project. my parent pom uses spring 3.1.1
这是我pom.xml中的activiti配置:
Here is my activiti config in my pom.xml:
<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
Also here is my 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的地方
Following is where I am trying to access 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
有人见过类似的问题吗?
Has anybody seen a similar issue.
推荐答案
无法将[org.activiti.engine.impl.RuntimeServiceImpl]类型的值转换为所需的[org.activiti.engine.RuntimeService]类型
Cannot convert value of type [org.activiti.engine.impl.RuntimeServiceImpl] to required type [org.activiti.engine.RuntimeService]
这意味着(a)您的接口不兼容,并且&提供的实现,或者(b)您遇到了一些类加载器问题,其中所需的接口在不同的类加载器中加载了两次.
It means either (a) your have incompatible required interface & provided implementation or (b) you you have some classloader issue, where required interface is loaded twice in different classloaders.
还要看一下堆栈跟踪中的最后一个异常-"...还有25个"隐藏了什么
Also take a look on the last exception in the stacktrace - what is hidden by "... 25 more"
这篇关于与Activiti集成时发生ConversionNotSupportedException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!