欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

将jbpm 整合到spring2+ibatis + struts2中的问题

程序员文章站 2022-05-21 15:05:44
...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
	http://www.springframework.org/schema/tx
	http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
	http://www.springframework.org/schema/aop
	http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
	<!--
	<bean id="conn" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"></property>
		<property name="url" value="jdbc:oracle:thin:@localhost:1521:Bear"></property>
		<property name="username" value="scott"></property>
		<property name="password" value="tiger"></property>
	</bean>

	<bean id="conn" class="org.apache.commons.dbcp.BasicDataSource">
		<property name="driverClassName" value="com.microsoft.jdbc.sqlserver.SQLServerDriver"></property>
		<property name="url" value="jdbc:microsoft:sqlserver://localhost:1433">
		</property>
		<property name="username" value="sa"></property>
		<property name="password" value=""></property>
	</bean>
	 -->
	<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/test?characterEncoding=GBK"></property>
		<property name="username" value="root"></property>
		<property name="password" value="test"></property>
	</bean>
	<!-- 
	<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">	
		<property name="configLocation">
            <value> 
                classpath:sqlMapConfig.xml
            </value>
        </property>
		<property name="dataSource" ref="dataSource" />
	</bean>
	 -->
	 
	<bean id="sqlMapClientTemplate" class="org.springframework.orm.ibatis.SqlMapClientTemplate">
	<property name="sqlMapClient">
		<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
			<property name="dataSource" ref="dataSource" />
			<property name="configLocation" value="classpath:sqlMapConfig.xml" />
		</bean>
	</property>
</bean>

	
	<bean id="sBookDAO"   class="cn.com.pms.createPro.dao.SBookDAO">  
        	<property name="sqlMapClientTemplate" ref="sqlMapClientTemplate" />  
    </bean>  
    
    <bean id="sBookServices"   class="cn.com.pms.createPro.service.SBookServices">  
        	<property name="sbookDAO" ref="sbookDAO" />  
        	<property name="createProService" ref="createProService" />  
    </bean>  
    
    
	<bean id="sessionFactory" name="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
		<property name="dataSource">
			<ref bean="dataSource" />
		</property>
		<property name="configLocation"
			value="classpath:hibernate.cfg.xml" />
        
		<property name="hibernateProperties">
			<props>
				<prop key="hibernate.dialect">
					org.hibernate.dialect.MySQLDialect
				</prop>
				<prop key="hibernate.show_sql">true</prop>
			</props>
		</property>
	</bean>
	<bean id="jbpmConfiguration"  
     class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">  
        <property name="sessionFactory" ref="sessionFactory" />  
        <property name="configuration" value="classpath:org/jbpm/default.jbpm.cfg.xml" /> 
        <property name="createSchema" value="false" />   
    </bean>  
    <bean id="jbpmTemplate"
		class="org.springmodules.workflow.jbpm31.JbpmTemplate">
		<constructor-arg index="0" ref="jbpmConfiguration" />
	</bean>
	<bean id="createProService" class="cn.com.pms.workflow.createPro.service.CreateProService">
		<property name="jbpmTemplate" ref="jbpmTemplate"></property>
	</bean>
 	<!--定义事务管理器 -->
	<bean id="transactionManager"
		class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
		<property name="dataSource" ref="dataSource" />
	</bean>
	
	<!-- 定义事务通知-->
	<tx:advice transaction-manager="transactionManager" id="txAdvice">
		<tx:attributes>
			<tx:method name="save*" propagation="REQUIRED"></tx:method>
		</tx:attributes>
	</tx:advice>
	
	<!--定义一个切面及切面和事务关联-->
	<aop:config>
		<aop:pointcut id="myPoint" expression="execution(* service..*.*(..))" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="myPoint" />
	</aop:config>
 
 </beans>

在启动tomcat的时候报了以下错误:
引用

11:59:09,269  INFO JbpmConfiguration:278 - using jbpm configuration resource 'jbpm.cfg.xml'
11:59:09,306  INFO StaleObjectLogConfigurer:37 - stale object exceptions will be hidden from logging
11:59:10,697  INFO LocalJbpmConfigurationFactoryBean:125 - creating JbpmConfiguration from resource class path resource [org/jbpm/default.jbpm.cfg.xml]
11:59:10,719  INFO LocalJbpmConfigurationFactoryBean:141 - using given Hibernate session factory
11:59:10,726  INFO LocalJbpmConfigurationFactoryBean:149 - persistence service available...
11:59:11,151  INFO DefaultListableBeanFactory:282 - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1eb904d: defining beans [firstAuditAssigner,springSBookAction,dataSource,sqlMapClientTemplate,sBookDAO,sBookServices,sessionFactory,jbpmConfiguration,jbpmTemplate,createProService,transactionManager,txAdvice,org.springframework.aop.config.internalAutoProxyCreator,myPoint,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor]; root of factory hierarchy
11:59:11,152  INFO LocalSessionFactoryBean:188 - Closing Hibernate SessionFactory
11:59:11,155 ERROR ContextLoader:204 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sBookServices' defined in ServletContext resource [/WEB-INF/SpringContext.xml]: Cannot resolve reference to bean 'sbookDAO' while setting bean property 'sbookDAO'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sbookDAO' is defined
Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sbookDAO' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:914)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
11:59:11,158 ERROR [/PMSDEMO]:3768 - 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 'sBookServices' defined in ServletContext resource [/WEB-INF/SpringContext.xml]: Cannot resolve reference to bean 'sbookDAO' while setting bean property 'sbookDAO'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sbookDAO' is defined
Caused by:
org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'sbookDAO' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:360)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:914)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:241)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:267)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:110)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:423)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:249)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:155)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:246)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:291)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:188)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3764)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
2009-7-19 11:59:11 org.apache.catalina.core.StandardContext start
严重: Error listenerStart

我开始怀疑:jbpm 能不能应用于ssi的架构中。有没有人用过此配方?
见笑了!发现N年前原来是自己把ID写错了,粗心的人啊!将jbpm 整合到spring2+ibatis + struts2中的问题
            
    
    博客分类: 我的问题  
  • 将jbpm 整合到spring2+ibatis + struts2中的问题
            
    
    博客分类: 我的问题  
  • 大小: 27.6 KB