我开始用tomcat+spring的一个项目中加入jbpm4.jbpm4和spring终于整合成功了,因为我测试了一次,运行一个简单流程没问题。然后我启动tomcat服务器,就出现以下错误提示:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jbpmConfiguration' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.jbpm.pvm.internal.cfg.SpringConfiguration]: Constructor threw exception; nested exception is java.lang.NoSuchMethodError: org.apache.log4j.Logger.trace(Ljava/lang/Object;)V
说找不到org.apache.log4j.Logger.trace(Ljava/lang/Object;)方法,我明明引入了那个包,而且也有那个方法。对了,关于tomcat和jbpm4冲突的那几个包(juel)我都调换了,tomcat我也重新卸载重装了,问题依旧。期待那位仁兄能帮我解释一下。
附上配置文件:application.xml
<?xml version="1.0" encoding="UTF-8"?>
xmlns="http://www.springframework.org/schema/beans"
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-2.5.xsd">
<bean id="dataSource"
class="org.apache.commons.dbcp.BasicDataSource">
<property name="driverClassName"
value="com.mysql.jdbc.Driver">
</property>
<property name="url"
value="jdbc:mysql://localhost:3306/jbpm4">
</property>
<property name="username" value="root"></property>
<property name="password" value="19876"></property>
<property name="maxActive" value="100"></property>
<property name="maxIdle" value="30"></property>
<property name="maxWait" value="50"></property>
<property name="defaultAutoCommit" value="true"></property>
</bean>
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource" ref="dataSource"></property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">
org.hibernate.dialect.MySQLInnoDBDialect
</prop>
<prop key="hibernate.show_sql">true</prop>
<prop key="hibernate.hbm2ddl.auto">update</prop>
<prop key="hibernate.format_sql">true</prop>
</props>
</property>
<property name="mappingResources">
<list>
<value>jbpm.repository.hbm.xml</value>
<value>jbpm.execution.hbm.xml</value>
<value>jbpm.history.hbm.xml</value>
<value>jbpm.task.hbm.xml</value>
<value>jbpm.identity.hbm.xml</value>
<value>bean/User.hbm.xml</value>
</list>
</property>
</bean>
<bean id="jbpmConfiguration" class="org.jbpm.pvm.internal.cfg.SpringConfiguration">
<constructor-arg value="jbpm.cfg.xml"></constructor-arg>
</bean>
<bean id="processEngine" factory-bean="jbpmConfiguration" factory-method="buildProcessEngine"></bean>
和jbpm.cfg.xml:
<?xml version="1.0" encoding="UTF-8"?>
[b]问题补充:[/b]
问题自己解决了,是log4j包我不小心导了两个。