[疑问] Activiti 自定义表达字段类型 报错
monkey_hi
2017-03-17
[color=darkred][/color]
报错信息如下 严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineConfiguration' defined in URL [file:/F:/eclipse/WorkPlace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/chapter14-management/WEB-INF/classes/applicationContext.xml]: Cannot create inner bean 'me.kafeitu.activiti.chapter6.form.JavascriptFormType#3278dcf9' of type [me.kafeitu.activiti.chapter6.form.JavascriptFormType] while setting bean property 'customFormTypes' with key [0]; nested exception is org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [me.kafeitu.activiti.chapter6.form.JavascriptFormType] for bean with name 'me.kafeitu.activiti.chapter6.form.JavascriptFormType#3278dcf9' defined in URL [file:/F:/eclipse/WorkPlace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/chapter14-management/WEB-INF/classes/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: me.kafeitu.activiti.chapter6.form.JavascriptFormType at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:290) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveManagedList(BeanDefinitionValueResolver.java:359) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:157) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1456) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1197) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475) at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:302) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:298) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:703) at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:760) at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:482) at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:403) at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:306) at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:106) at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:5099) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5615) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561) at java.util.concurrent.FutureTask.run(Unknown Source) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [me.kafeitu.activiti.chapter6.form.JavascriptFormType] for bean with name 'me.kafeitu.activiti.chapter6.form.JavascriptFormType#3278dcf9' defined in URL [file:/F:/eclipse/WorkPlace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/chapter14-management/WEB-INF/classes/applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: me.kafeitu.activiti.chapter6.form.JavascriptFormType at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1325) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:452) at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:276) ... 26 more Caused by: java.lang.ClassNotFoundException: me.kafeitu.activiti.chapter6.form.JavascriptFormType at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1891) at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1734) at org.springframework.util.ClassUtils.forName(ClassUtils.java:247) at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanClass(AbstractBeanDefinition.java:395) at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClass(AbstractBeanFactory.java:1346) at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(AbstractBeanFactory.java:1317) ... 28 more 流程引擎配置:如下: <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd"> <!-- 读取资源文件替换spring配置文件中的占位符 --> <context:property-placeholder ignore-unresolvable="true" location="classpath*:/application.properties" /> <!-- 使用annotation 自动注册bean, 并保证@Required、@Autowired的属性被注入 --> <context:component-scan base-package="me.kafeitu.activiti"> <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" /> </context:component-scan> <!-- 数据源 --> <bean id="dataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource"> <property name="driverClass" value="${jdbc.driver}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> <!-- SessionFactory --> <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="namingStrategy"> <bean class="org.hibernate.cfg.ImprovedNamingStrategy" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.H2Dialect</prop> <prop key="hibernate.show_sql">false</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.hbm2ddl.auto">update</prop> </props> </property> <property name="packagesToScan" value="me.kafeitu.activiti.chapter7.entity" /> </bean> <!-- 事务管理 --> <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory" /> </bean> <tx:annotation-driven transaction-manager="transactionManager" proxy-target-class="true" /> <!-- Activiti引擎配置 --> <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration"> <property name="processEngineName" value="spring" /> <property name="dataSource" ref="dataSource" /> <property name="transactionManager" ref="transactionManager" /> <property name="databaseSchemaUpdate" value="true" /> <property name="jobExecutorActivate" value="false" /> <property name="deploymentResources"> <list> <value>classpath*:/chapter6/**/*.zip</value> <value>classpath*:/chapter7/**/*.zip</value> </list> </property> <property name="mailServerPort" value="2025" /> <!-- 生成流程图的字体 --> <property name="activityFontName" value="宋体" /> <property name="labelFontName" value="宋体" /> <!-- 自定义表单字段类型 --> <property name="customFormTypes"> <list> <bean class="me.kafeitu.activiti.chapter6.form.JavascriptFormType" /> <bean class="me.kafeitu.activiti.chapter9.form.UsersFormType" /> <bean class="me.kafeitu.activiti.chapter10.form.DoubleFormType" /> <bean class="me.kafeitu.activiti.chapter10.form.BigtextFormType" /> </list> </property> </bean> <!-- Activiti引擎工厂 --> <bean id="processEngineFactory" class="org.activiti.spring.ProcessEngineFactoryBean"> <property name="processEngineConfiguration" ref="processEngineConfiguration" /> </bean> <!-- Activiti的Service --> <bean id="repositoryService" factory-bean="processEngineFactory" factory-method="getRepositoryService" /> <bean id="runtimeService" factory-bean="processEngineFactory" factory-method="getRuntimeService" /> <bean id="formService" factory-bean="processEngineFactory" factory-method="getFormService" /> <bean id="identityService" factory-bean="processEngineFactory" factory-method="getIdentityService" /> <bean id="taskService" factory-bean="processEngineFactory" factory-method="getTaskService" /> <bean id="historyService" factory-bean="processEngineFactory" factory-method="getHistoryService" /> <bean id="managementService" factory-bean="processEngineFactory" factory-method="getManagementService" /> </beans> |